Public report of agno-agi/agno, published 25 October 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 25 October 2026, 10:18 UTC · Survey ID cd_f10b18c27a634cfe916f5bb9dc5b8f9f

agno-agi/agno

Measured 25 October 2026, 10:04 UTC, at code version 6d5af04

Regression: 1 dimension fell since the last survey Code coverage: not measured

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureNoCollector).

CAI score 48out of 100 At risk Up 4 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A very large codebase: 611,552 lines of product code in 8 projects, tests not counted · Estimated rebuild effort: about 6.5 person-years · Weakest lens: Production Readiness, 36

Findings by how serious they are

274 critical 6614 serious 642 minor

9 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
25 October 2026, 10:04 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

85of 85 dimensions measured by tools.
7398of 7530 findings point to an exact file and line, so you can open each one in the code. The other 132 concern the repository as a whole, such as missing documentation.
85dimensions across 8 lenses, read from 611,552 lines of product code in 8 projects.
Chapters

Executive summary

agno-agi/agno is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because 16 passwords or keys sit in the current code and we found no automated security scanning of the code, its secrets or its dependencies. It scores 48 out of 100, which the At risk rating leaves unchanged.

Production Readiness, at 36, is the weakest lens and counts most in the score. The best first step for the work it takes is replacing the two packages under a banned licence, worth about 8 points. Replacing the 16 exposed passwords or keys and switching the old ones off would lift Production Readiness itself, worth about 11 points. Raising Production Readiness to 70 would lift the score to about 59.

125 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Forty-four known security holes in the packages the code depends on can be used by attackers, and forty-three pipeline steps run downloads nobody checks. Pinning each tool to an exact version, updating the vulnerable packages and checking each download against a checksum would close these risks. The 16 passwords or keys in the code and the 13 passwords or keys in the code's history need replacing, with the old ones switched off. The six pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The nine form fields without a label need a label.

The product code is 611,552 lines, about €950,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Production Readiness 36 · counts for 45%Accessibility 53 · counts for 25%Performance 60 · counts for 14%Code Health 62 · counts for 8%Maturity 62 · counts for 4%Security and Compliance 72 · counts for 2%Architecture 94 · counts for 1%Domain Modelling 100 · counts for 1%

If Production Readiness rose from 36 to 70, the lowest score rated Strong, the score would rise from 48 to about 59.

Code composition: what the lines of code are
Product code 59%Tests 41%
New since the last survey: 581 findings

These 581 critical or serious findings weren't in the previous survey, on 11 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · _CompanyScheduleExecutor._accept (cyclomatic 63) libs/agno/agno/company/routines.py
  • Cyclomatic Complexity · diagnostics._check (cyclomatic 48) libs/agno/agno/os/diagnostics.py
  • Cyclomatic Complexity · FunctionCall._aexecute (cyclomatic 34) libs/agno/agno/tools/function.py
  • Cyclomatic Complexity · _CompanyScheduleExecutor.execute (cyclomatic 33) libs/agno/agno/company/routines.py
  • Cyclomatic Complexity · bootstrap.arehydrate_product (cyclomatic 31) libs/agno/agno/company/bootstrap.py
  • Cyclomatic Complexity · _CompanyScheduleExecutor._dispatch (cyclomatic 30) libs/agno/agno/company/routines.py
  • Cyclomatic Complexity · sources.validate_source_fields (cyclomatic 30) libs/agno/agno/db/schemas/sources.py
  • Cyclomatic Complexity · sandbox._sandbox_start_gate (cyclomatic 29) libs/agno/agno/os/routers/company/sandbox.py
  • Cyclomatic Complexity · routines._routine_failure (cyclomatic 27) libs/agno/agno/company/routines.py
  • Cyclomatic Complexity · FunctionCall._execute (cyclomatic 27) libs/agno/agno/tools/function.py
  • Cyclomatic Complexity · _media.stage_media (cyclomatic 26) libs/agno/agno/agents/_media.py
  • Cyclomatic Complexity · refresh.arefresh_product (cyclomatic 25) libs/agno/agno/company/refresh.py
  • Cyclomatic Complexity · _CompanyScheduleExecutor._tick (cyclomatic 24) libs/agno/agno/company/routines.py
  • Cyclomatic Complexity · sources.browse_source (cyclomatic 24) libs/agno/agno/company/sources.py
  • Cyclomatic Complexity · sources._local_files (cyclomatic 23) libs/agno/agno/company/sources.py
  • Cyclomatic Complexity · summary._summary_report (cyclomatic 23) libs/agno/agno/company/summary.py
  • Cyclomatic Complexity · AuthMiddleware._deny_for_schedule_owner (cyclomatic 23) libs/agno/agno/os/middleware/jwt.py
  • Cyclomatic Complexity · ClaudeAgent._aquery_sdk (cyclomatic 22) libs/agno/agno/agents/claude/agent.py
  • Cyclomatic Complexity · diagnostics.arun_diagnostics (cyclomatic 20) libs/agno/agno/os/diagnostics.py
  • Cyclomatic Complexity · sandbox.sandbox_run_response (cyclomatic 20) libs/agno/agno/os/routers/agents/sandbox.py
  • Cyclomatic Complexity · Workspace._list_files (cyclomatic 20) libs/agno/agno/tools/workspace.py
  • Cyclomatic Complexity · RedisDb.enqueue_job (cyclomatic 19) libs/agno/agno/db/redis/redis.py
  • Cyclomatic Complexity · automation_history._record_task_failures (cyclomatic 17) libs/agno/agno/company/automation_history.py
  • Cyclomatic Complexity · _CompanyScheduleExecutor._complete_projects (cyclomatic 17) libs/agno/agno/company/routines.py
  • Cyclomatic Complexity · tasks.validate_task_fields (cyclomatic 17) libs/agno/agno/db/schemas/tasks.py
  • Cyclomatic Complexity · QueueWorker.acancel_queued (cyclomatic 17) libs/agno/agno/os/job_queue.py
  • Cyclomatic Complexity · run_permissions._require_endpoint_permission (cyclomatic 17) libs/agno/agno/os/routers/run_permissions.py
  • Cyclomatic Complexity · ScheduleExecutor._poll_run (cyclomatic 17) libs/agno/agno/scheduler/executor.py
  • Cyclomatic Complexity · ChartTools._build_spec (cyclomatic 17) libs/agno/agno/tools/chart.py
  • Cyclomatic Complexity · Workspace._search_content (cyclomatic 17) libs/agno/agno/tools/workspace.py
  • Cyclomatic Complexity · Condition._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/condition.py
  • Cyclomatic Complexity · Loop._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/loop.py
  • Cyclomatic Complexity · Router._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/router.py
  • Cyclomatic Complexity · Steps._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/steps.py
  • Cyclomatic Complexity · soak.main (cyclomatic 17) cookbook/frameworks/reliability/soak.py
  • Cyclomatic Complexity · AsyncPostgresDb.transition_project (cyclomatic 16) libs/agno/agno/db/postgres/async_postgres.py
  • Cyclomatic Complexity · AsyncPostgresDb.get_tasks (cyclomatic 16) libs/agno/agno/db/postgres/async_postgres.py
  • Cyclomatic Complexity · PostgresDb.transition_project (cyclomatic 16) libs/agno/agno/db/postgres/postgres.py
  • Cyclomatic Complexity · PostgresDb.get_tasks (cyclomatic 16) libs/agno/agno/db/postgres/postgres.py
  • Cyclomatic Complexity · AsyncSqliteDb.transition_project (cyclomatic 16) REDACTED
  • Cyclomatic Complexity · AsyncSqliteDb.get_tasks (cyclomatic 16) REDACTED
  • Cyclomatic Complexity · SqliteDb.transition_project (cyclomatic 16) REDACTED
  • Cyclomatic Complexity · SqliteDb.get_tasks (cyclomatic 16) REDACTED
  • Cyclomatic Complexity · FileSystemTools.alist_files (cyclomatic 16) libs/agno/agno/fs/toolkit.py
  • Cyclomatic Complexity · router.agent_resumable_response_streamer (cyclomatic 16) libs/agno/agno/os/routers/agents/router.py
  • Cyclomatic Complexity · sandbox.enqueue_sandbox_run (cyclomatic 16) libs/agno/agno/os/routers/agents/sandbox.py
  • Cyclomatic Complexity · components._resolve_member_links (cyclomatic 16) libs/agno/agno/os/routers/components/components.py
  • Cognitive Complexity · diagnostics._check (cognitive 77) libs/agno/agno/os/diagnostics.py
  • Cognitive Complexity · _CompanyScheduleExecutor._accept (cognitive 74) libs/agno/agno/company/routines.py
  • Cognitive Complexity · _media.stage_media (cognitive 62) libs/agno/agno/agents/_media.py
  • Cognitive Complexity · bootstrap.arehydrate_product (cognitive 55) libs/agno/agno/company/bootstrap.py
  • Cognitive Complexity · routines._routine_failure (cognitive 51) libs/agno/agno/company/routines.py
  • Cognitive Complexity · _CompanyScheduleExecutor.execute (cognitive 50) libs/agno/agno/company/routines.py
  • Cognitive Complexity · sandbox._sandbox_start_gate (cognitive 50) libs/agno/agno/os/routers/company/sandbox.py
  • Cognitive Complexity · _CompanyScheduleExecutor._tick (cognitive 46) libs/agno/agno/company/routines.py
  • Cognitive Complexity · FunctionCall._aexecute (cognitive 45) libs/agno/agno/tools/function.py
  • Cognitive Complexity · refresh.arefresh_product (cognitive 43) libs/agno/agno/company/refresh.py
  • Cognitive Complexity · Workspace._list_files (cognitive 42) libs/agno/agno/tools/workspace.py
  • Cognitive Complexity · ClaudeAgent._aquery_sdk (cognitive 41) libs/agno/agno/agents/claude/agent.py
  • Cognitive Complexity · diagnostics.arun_diagnostics (cognitive 39) libs/agno/agno/os/diagnostics.py
  • Cognitive Complexity · sources.validate_source_fields (cognitive 36) libs/agno/agno/db/schemas/sources.py
  • Cognitive Complexity · _CompanyScheduleExecutor._complete_projects (cognitive 35) libs/agno/agno/company/routines.py
  • Cognitive Complexity · _CompanyScheduleExecutor._dispatch (cognitive 35) libs/agno/agno/company/routines.py
  • Cognitive Complexity · sources.browse_source (cognitive 34) libs/agno/agno/company/sources.py
  • Cognitive Complexity · FunctionCall._execute (cognitive 34) libs/agno/agno/tools/function.py
  • Cognitive Complexity · Workspace._search_content (cognitive 33) libs/agno/agno/tools/workspace.py
  • Cognitive Complexity · summary._summary_report (cognitive 29) libs/agno/agno/company/summary.py
  • Cognitive Complexity · sources._local_files (cognitive 28) libs/agno/agno/company/sources.py
  • Cognitive Complexity · sandbox.sandbox_run_response (cognitive 28) libs/agno/agno/os/routers/agents/sandbox.py
  • Cognitive Complexity · automation_history._record_task_failures (cognitive 27) libs/agno/agno/company/automation_history.py
  • Cognitive Complexity · routines._authorize_auto_accept (cognitive 24) libs/agno/agno/company/routines.py
  • Cognitive Complexity · ChartTools._build_spec (cognitive 24) libs/agno/agno/tools/chart.py
  • Cognitive Complexity · public_fetch._fetch (cognitive 23) libs/agno/agno/knowledge/reader/utils/public_fetch.py
  • Cognitive Complexity · QueueWorker.acancel_queued (cognitive 23) libs/agno/agno/os/job_queue.py
  • Cognitive Complexity · run_permissions._require_endpoint_permission (cognitive 22) libs/agno/agno/os/routers/run_permissions.py
  • Cognitive Complexity · soak.main (cognitive 22) cookbook/frameworks/reliability/soak.py
  • Cognitive Complexity · execution._validate_executor_tools (cognitive 21) libs/agno/agno/company/execution.py
  • Cognitive Complexity · sources._documents (cognitive 21) libs/agno/agno/company/sources.py
  • Cognitive Complexity · FileSystemTools.alist_files (cognitive 21) libs/agno/agno/fs/toolkit.py
  • Cognitive Complexity · 07_cascading_archive.main (cognitive 21) REDACTED
  • Cognitive Complexity · _media.stage_prior_media (cognitive 20) libs/agno/agno/agents/_media.py
  • Cognitive Complexity · execution._recover_task (cognitive 20) libs/agno/agno/company/execution.py
  • Cognitive Complexity · execution._mount_executors (cognitive 20) libs/agno/agno/company/execution.py
  • Cognitive Complexity · BaseExternalAgent._apersist_run_in_session (cognitive 19) libs/agno/agno/agents/base.py
  • Cognitive Complexity · base.session_branch (cognitive 19) libs/agno/agno/agents/base.py
  • Cognitive Complexity · job_queue.resolve_queue_scope (cognitive 19) libs/agno/agno/os/job_queue.py
  • Cognitive Complexity · router.agent_resumable_response_streamer (cognitive 19) libs/agno/agno/os/routers/agents/router.py
  • Cognitive Complexity · execution._cancel_ticketless_pending_run (cognitive 18) libs/agno/agno/company/execution.py
  • Cognitive Complexity · AsyncPostgresDb.enqueue_job (cognitive 18) libs/agno/agno/db/postgres/async_postgres.py
  • Cognitive Complexity · PostgresDb.enqueue_job (cognitive 18) libs/agno/agno/db/postgres/postgres.py
  • Cognitive Complexity · RedisDb._q_try_claim (cognitive 18) libs/agno/agno/db/redis/redis.py
  • Cognitive Complexity · Condition._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/condition.py
  • Cognitive Complexity · Loop._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/loop.py
  • Cognitive Complexity · Router._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/router.py
  • Cognitive Complexity · Steps._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/steps.py
  • Cognitive Complexity · _media.prior_attachments (cognitive 17) libs/agno/agno/agents/_media.py
  • Cognitive Complexity · routines._ensure_automation_schedule (cognitive 17) libs/agno/agno/company/routines.py
  • Cognitive Complexity · AsyncPostgresDb.transition_project (cognitive 17) libs/agno/agno/db/postgres/async_postgres.py
  • Cognitive Complexity · PostgresDb.transition_project (cognitive 17) libs/agno/agno/db/postgres/postgres.py
  • Cognitive Complexity · company.create_company_source (cognitive 17) libs/agno/agno/db/sql/company.py

Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 381 findings

These 381 critical or serious findings were in the previous survey, on 11 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · FunctionCall.aexecute (cyclomatic 32) libs/agno/agno/tools/function.py
  • Cyclomatic Complexity · FunctionCall.execute (cyclomatic 25) libs/agno/agno/tools/function.py
  • Cyclomatic Complexity · BaseExternalAgent.print_response (cyclomatic 24) libs/agno/agno/agents/base.py
  • Cyclomatic Complexity · BaseExternalAgent.aprint_response (cyclomatic 24) libs/agno/agno/agents/base.py
  • Cyclomatic Complexity · ClaudeAgent._aquery (cyclomatic 22) libs/agno/agno/agents/claude/agent.py
  • Cyclomatic Complexity · BaseExternalAgent._get_history_from_session (cyclomatic 20) libs/agno/agno/agents/base.py
  • Cyclomatic Complexity · Workspace.list_files (cyclomatic 20) libs/agno/agno/tools/workspace.py
  • Cyclomatic Complexity · AuthMiddleware.__init__ (cyclomatic 19) libs/agno/agno/os/middleware/jwt.py
  • Cyclomatic Complexity · Workspace.search_content (cyclomatic 17) libs/agno/agno/tools/workspace.py
  • Cognitive Complexity · BaseExternalAgent.print_response (cognitive 47) libs/agno/agno/agents/base.py
  • Cognitive Complexity · BaseExternalAgent.aprint_response (cognitive 47) libs/agno/agno/agents/base.py
  • Cognitive Complexity · FunctionCall.aexecute (cognitive 43) libs/agno/agno/tools/function.py
  • Cognitive Complexity · Workspace.list_files (cognitive 42) libs/agno/agno/tools/workspace.py
  • Cognitive Complexity · ClaudeAgent._aquery (cognitive 41) libs/agno/agno/agents/claude/agent.py
  • Cognitive Complexity · Workspace.search_content (cognitive 33) libs/agno/agno/tools/workspace.py
  • Cognitive Complexity · FunctionCall.execute (cognitive 32) libs/agno/agno/tools/function.py
  • Cognitive Complexity · BaseExternalAgent._get_history_from_session (cognitive 28) libs/agno/agno/agents/base.py
  • Cognitive Complexity · AuthMiddleware.__init__ (cognitive 20) libs/agno/agno/os/middleware/jwt.py
  • Code Duplication · Near-duplicate member family (7 members, 14 shared lines) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Near-duplicate member family (4 members, 43 shared lines) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Near-duplicate member family (4 members, 36 shared lines) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Near-duplicate member family (4 members, 28 shared lines) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Near-duplicate member pair (728 shared lines) libs/agno/agno/os/routers/agents/router.py
  • Code Duplication · Near-duplicate member pair (102 shared lines) libs/agno/agno/agents/base.py
  • Code Duplication · Near-duplicate member pair (80 shared lines) libs/agno/agno/scheduler/manager.py
  • Code Duplication · Edited copy of a member (32 corresponding lines) libs/agno/agno/db/redis/redis.py
  • Code Duplication · Members sharing a duplicated core (21 members, 50+ identical tokens) libs/agno/agno/agent/_cli.py
  • Code Duplication · Members sharing a duplicated core (20 members, 50+ identical tokens) libs/agno/agno/workflow/condition.py
  • Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/dynamo/dynamo.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/agent/_session.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/client/os.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/client/os.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/dynamo/dynamo.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/dynamo/dynamo.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/firestore/firestore.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/postgres/postgres.py
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/tools/scheduler.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/agent/_storage.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/db/gcs_json/gcs_json_db.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/db/redis/redis.py
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/workflow/utils/hitl.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/agent.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/client/os.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/gcs_json/gcs_json_db.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/utils.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/postgres.py
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/postgres/postgres.py
Rebuild cost: about €950,000 · Estimate
Cost to rebuild€320,000 to €1,600,000, for 5,253 to 16,666 hours of work, about 6.5 person-years for 3 to 13 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 48. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 611,552 lines of product code

How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Resolve the 2 Banned license finding(s) in License Compliance.
Raises the score by about 8 points · Low effort · License Compliance
2
Resolve the 16 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.
Raises the score by about 11 points · Medium effort · REDACTED Scanning
3
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Raises the score by about 6 points · Medium effort · Security & performance tooling

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €950,000 to build again, about 6.5 person-years of work. Its weakest lens is Production Readiness, at 36 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Banned license finding(s) in License Compliance. Of all the actions in this report, it raises the score most for the work it takes: about 8 points for low effort, because it clears the 2 License Compliance findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.4 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 6% to 15% on every change. The history of the code shows how much it changes: about 506,845 lines over the last 90 days, which is about 2,055,538 lines a year. At that pace, the extra work comes to an estimated 333 to 1998.2 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.

arch agno agno agno-infra agno-infra agno-openui-frontend agno-openui-frontend agnoctl agnoctl

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

1491 modules, with 235 dependencies between them. Every module uses only modules listed above it, so there are no loops.

The table shows the 40 modules with the most connections; 1451 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 api2 context.mode3 db.schemas.evals4 db.schemas.knowledge5 db.schemas.memory6 models.message7 run.agent8 run.base9 agent.agent10 agents.base11 client.a2a12 context.provider13 db.base14 agent15 client.os16 context.backend17 context.calendar.provider18 context.gdrive.provider19 context.gmail.provider20 context.mcp.provider21 context.slack.provider22 context.wiki.provider23 context.workspace.provider24 db.dynamo.dynamo25 db.firestore.firestore26 db.gcs_json.gcs_json_db27 db.in_memory.in_memory_db28 db.json.json_db29 db.mongo.async_mongo30 db.mongo.mongo31 db.mysql.async_mysql32 db.mysql.mysql33 db.postgres.async_postgres34 db.postgres.postgres35 db.redis.redis36 db.singlestore.singlestore37 db.sqlite.async_sqlite38 db.sqlite.sqlite39 company40 context.web.provider
1 api
2 context.mode
3 db.schemas.evals
4 db.schemas.knowledge
5 db.schemas.memory
6 models.message
7 run.agent
8 run.base
9 agent.agent11
10 agents.base41
11 client.a2a1
12 context.provider1
13 db.base2222
14 agent185142
15 client.os111
16 context.backend1
17 context.calendar.provider113
18 context.gdrive.provider113
19 context.gmail.provider113
20 context.mcp.provider113
21 context.slack.provider113
22 context.wiki.provider113
23 context.workspace.provider113
24 db.dynamo.dynamo1111
25 db.firestore.firestore1111
26 db.gcs_json.gcs_json_db1111
27 db.in_memory.in_memory_db1111
28 db.json.json_db1111
29 db.mongo.async_mongo1111
30 db.mongo.mongo1111
31 db.mysql.async_mysql1111
32 db.mysql.mysql1111
33 db.postgres.async_postgres11111
34 db.postgres.postgres11112
35 db.redis.redis1111
36 db.singlestore.singlestore1111
37 db.sqlite.async_sqlite11111
38 db.sqlite.sqlite1112
39 company1
40 context.web.provider1131
Uses a module listed above itPart of a loopThe module itself
1 api2 context.mode3 db.schemas.evals4 db.schemas.knowledge5 db.schemas.memory6 models.message7 run.agent8 run.base9 agent.agent10 agents.base11 client.a2a12 context.provider13 db.base14 agent15 client.os16 context.backend17 context.calendar.provider18 context.gdrive.provider19 context.gmail.provider20 context.mcp.provider21 context.slack.provider22 context.wiki.provider23 context.workspace.provider24 db.dynamo.dynamo25 db.firestore.firestore26 db.gcs_json.gcs_json_db27 db.in_memory.in_memory_db28 db.json.json_db29 db.mongo.async_mongo30 db.mongo.mongo31 db.mysql.async_mysql32 db.mysql.mysql33 db.postgres.async_postgres34 db.postgres.postgres35 db.redis.redis36 db.singlestore.singlestore37 db.sqlite.async_sqlite38 db.sqlite.sqlite39 company40 context.web.providerapi1context.mode2db.schemas.evals3db.schemas.knowledge4db.schemas.memory5models.message6run.agent7run.base8agent.agent9agents.base10client.a2a11context.provider12db.base13agent14client.os15context.backend16context.calendar.provider17context.gdrive.provider18context.gmail.provider19context.mcp.provider20context.slack.provider21context.wiki.provider22context.workspace.provider23db.dynamo.dynamo24db.firestore.firestore25db.gcs_json.gcs_json_db26db.in_memory.in_memory_db27db.json.json_db28db.mongo.async_mongo29db.mongo.mongo30db.mysql.async_mysql31db.mysql.mysql32db.postgres.async_postgres33db.postgres.postgres34db.redis.redis35db.singlestore.singlestore36db.sqlite.async_sqlite37db.sqlite.sqlite38company39context.web.provider401141112222185142111111311311311311311311311111111111111111111111111111111111111111111121111111111111111211131+1451 more modules (most-connected shown)

At a glance — Code Health · 62% · Adequate · gated by D1, D2 ·

At a glance — Architecture · 94% · Adequate · gated by D26 ·

At a glance — Maturity · 62% · Adequate · gated by M2 ·

At a glance — Readiness · 36% · Weak · gated by D13, P3, P7, P8 ·

At a glance — Security · 72% · Adequate · gated by D28, D29, D30 ·

At a glance — Domain Modelling · 100% · Exemplary ·

At a glance — Accessibility · 53% · Adequate ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A05:2025 — Injection557High / Critical
A03:2025 — Software Supply Chain Failures69High / Critical
A07:2025 — Authentication Failures30High / Critical
A02:2025 — Security Misconfiguration4High / Critical

Roadmap

Immediately resolve the 16 leaked secrets in core authentication files and the two banned license violations to address critical compliance and security risks. Integrate a SAST step into the CI pipeline to prevent future security regressions from reaching production. Strengthen system stability by enforcing timeouts and retry logic on all outbound HTTP calls, and replace ad-hoc database creation with Alembic migrations to ensure safe, reproducible schema evolution.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Resolve the 2 Banned license finding(s) in License Compliance.+8.5 ptsLowLicense Compliance
Resolve the 16 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.+10.5 ptsMediumREDACTED Scanning
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.+5.6 ptsMediumSecurity & performance tooling
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.+2.2 ptsMediumOutbound HTTP resilience
Replace SQLAlchemy create_all() with Alembic (`alembic revision --autogenerate` + `alembic upgrade head`) so the production schema can evolve safely and reproducibly.+2.2 ptsMediumSchema migrations
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.+2.0 ptsMediumForms & labels
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.+2.0 ptsMediumA11y enforcement
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.+2.0 ptsMediumVisual & motion safety

File quality

Per-file score 0–10 — a quality signature. Of 772 files carrying findings, judged against the Production bar: 1% slop · 71% mixed · 28% near-clean.

FileScoreBandWorst signal
REDACTED0.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.5SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.8SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.6SlopREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 274

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 6614

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 642

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 9

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 85 of 85 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.8 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 85 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D16D17D19D20D26D27D28D29D30D31D34D35D36D43D44AC1AC2AC3AC5AC6AC7AX10AX2AX3AX4C2DM6M1M2M3M4P1P10P2P3P4P5P6P7P8PF3R1R10R2R3R4R6R7R8R9S1X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X27X28X29X3X30X4X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 7398 of 7530 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a17285-32e9-78c3-8ae4-f711a23e1872.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 5 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,625 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the dependency install for cookbook/05_agent_os/16_agui/openui/frontend/ failed in the analyzer sandbox (npm error Cannot read properties of null (reading 'edgesOut')), so the suite never ran. This is OUR limitation, not a defect in the repo — it is excluded from the score.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in cookbook/05_agent_os/16_agui/openui/frontend/ was NOT MEASURED: the dependency install for cookbook/05_agent_os/16_agui/openui/frontend/ failed in the analyzer sandbox (npm error Cannot read properties of null (reading 'edgesOut')), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in libs/agno/agno/os/authz/user_directory.py, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (REDACTED). compose up failed (exit 18 — an image could not be pulled) — db Pulling toolbox Pulling db Error Get "https://registry-1.docker.io/v2/": Forbidden toolbox Error context canceled Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the earlier `compose pull` step reported: toolbox Pulling db Pulling db Error Get "https://registry-1.docker.io/v2/": Forbidden toolbox Error context canceled Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the runtime sandbox reaches registries only through the in-fence pull-through mirror, so an image the mirror does not carry cannot be fetched — this is a limit of our sandbox, not of your stack; runtime evidence skipped.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P7 Outbound HTTP resilience — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 61 further occurrence(s) are not listed individually; the score already reflects all 101.
  • X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 206 further occurrence(s) are not listed individually; the score already reflects all 246.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned REDACTED, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity2.5 / 10Weak✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Prevented

874 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Workflow._acontinue_execute_stream at 164. A further 2 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being AsyncSqliteDb._get_table at 24 — they are counted neither in the figure above nor in this dimension's score.

router._resume_stream_generator (cyclomatic 19) · ×3libs/agno/agno/os/routers/agents/router.py:495
_run_options.resolve_run_options (cyclomatic 20) · ×2libs/agno/agno/agent/_run_options.py:79
_response.update_reasoning_content_from_tool_call (cyclomatic 16) · ×2libs/agno/agno/agent/_response.py:752
utils.calculate_date_metrics (cyclomatic 16) · ×2libs/agno/agno/db/mongo/utils.py:140
Workflow._acontinue_execute_stream (cyclomatic 164)libs/agno/agno/workflow/workflow.py:9566

+ 864 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 10 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with Workflow._acontinue_execute_stream (cyclomatic 164), Workflow._continue_execute_stream (cyclomatic 163), team.aprint_response_stream (cyclomatic 160). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 10 together lifts Cyclomatic Complexity from 2.5 to about 3.3/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

1417 method(s) exceeded the cognitive complexity threshold of 15; the worst was team.aprint_response_stream at 371.

utils.calculate_date_metrics (cognitive 23) · ×9libs/agno/agno/db/dynamo/utils.py:355
router._resume_stream_generator (cognitive 30) · ×3libs/agno/agno/os/routers/agents/router.py:495
_response.aparse_response_with_parser_model_stream (cognitive 34) · ×2libs/agno/agno/agent/_response.py:513
_response.parse_response_with_parser_model_stream (cognitive 30) · ×2libs/agno/agno/agent/_response.py:445
cancel_run.long_running_task (cognitive 22) · ×2cookbook/02_agents/14_advanced/cancel_run.py:17

+ 1392 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 520 bodies over 30 down to 30 or less in Cognitive Complexity — start with team.aprint_response_stream (cognitive 371), team.print_response_stream (cognitive 349), _response._handle_model_response_chunk (cognitive 342). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 520 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes8.6 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 8.6 / 10 · rule-coverage 100% · ceiling Prevented

222 god class(es) detected.

FileTooLong: workflow/workflow.py · ×152libs/agno/agno/workflow/workflow.py
TooManyMethods: PostgresDb · ×69libs/agno/agno/db/postgres/postgres.py:135
FunctionTooLong: index.html.imageSearchcookbook/data_labeling/image_search/public/index.html:273

What to do

  1. Resolve the 152 FileTooLong finding(s) in God Classes — start with router.py (7), REDACTED (6), REDACTED (4). — One of this dimension's main actionable groups (152 warning-level).
  2. Resolve the 69 TooManyMethods finding(s) in God Classes — start with REDACTED (3), REDACTED (2), surrealdb.py (2). — One of this dimension's main actionable groups (69 warning-level).
  3. Resolve the 1 FunctionTooLong finding(s) in God Classes — start with index.html. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication7.3 / 10Strong✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.3 / 10 · rule-coverage 100% · ceiling Verified

3337 duplicated block group(s) detected. A further 320 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 5 of the 3657 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Members sharing a duplicated core (4 members, 50+ identical tokens) · ×112cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:103
Duplicated block (11 lines × 2) · ×110cookbook/02_agents/15_dependencies/dependencies_in_tools.py:55
Duplicated block (13 lines × 2) · ×99cookbook/02_agents/11_approvals/approval_async.py:76
Duplicated block (14 lines × 2) · ×95cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:79
Duplicated block (8 lines × 2) · ×95cookbook/02_agents/05_state_and_session/metadata_resolution.py:57

+ 798 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 112 Members sharing a duplicated core (4 members, 50+ identical tokens) finding(s) in Code Duplication — start with async_postgres.py (23), mysql.py (10), postgres.py (5). — One of this dimension's main actionable groups (112 warning-level).
  2. Resolve the 110 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with async_postgres.py (6), postgres.py (6), router.py (5). — One of this dimension's main actionable groups (110 warning-level).
  3. Resolve the 99 Duplicated block (13 lines × 2) finding(s) in Code Duplication — start with router.py (9), async_postgres.py (8), async_mongo.py (6). — One of this dimension's main actionable groups (99 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

4 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence.

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)9.8 / 10Stronggated by 6 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Verified

6 of 380 classes have LCOM4 above 3.

Low cohesion: GmailTools (LCOM4 17) · ×6libs/agno/agno/tools/google/gmail.py:131

What to do

  1. Resolve the 6 Low cohesion finding(s) in Cohesion (LCOM4) — start with gmail.py, in_memory_db.py, filesystem.py. — One of this dimension's main actionable groups (6 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

26141 test methods: 20645 unit, 5428 integration, 27 BDD, 41 e2e. The JavaScript/TypeScript suite contributes 5 `it`/`test` case(s) across 2 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 26136 test function(s) across 1429 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 5 tests. Measured on the JavaScript/TypeScript suite only — at least 1,625 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.

✓ On the Gold path — maintain.

Detailed fixes: d10_recommendation.md.

D12 · Dependency Hygiene8.0 7.9 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 7.9 / 10 · rule-coverage 99% · ceiling Verified

104 outdated, 0 yanked pinned Python distributions. 157 of 159 shipped distributions were graded against pypi.org (0 not published there, 2 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, REDACTED, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.

Outdated: agno · ×104

What to do

  1. Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · REDACTED Scanning0.0 / 10Critical✓ Tool-verified

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Prevented

16 secret(s) detected.

REDACTED

What to do

  1. Resolve the 16 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (16 issue-level).
  2. Enforce REDACTED Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.

D14 · License Compliance6.0 / 10Adequate✓ Tool-verified

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Verified

2 of 179 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 159 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (20 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. 8 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here.

Banned license: psycopg · ×2

What to do

  1. Resolve the 2 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (2 issue-level).
  2. Enforce License Compliance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.

D15 · Churn × Complexity Hotspots9.5 / 10Stronggated by 112 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: libs/agno/agno/os/app.py (38×74=2812); libs/agno/agno/workflow/workflow.py (11×164=1804); libs/agno/agno/agent/_storage.py (10×144=1440) Repeated repair below the complexity floor: libs/agno/agno/os/routers/company/runs.py (5 of 8 changes were fixes); libs/agno/agno/exceptions.py (5 of 8 changes were fixes); libs/agno/agno/os/routers/knowledge/knowledge.py (4 of 7 changes were fixes)

Hotspot: libs/agno/agno/os/app.py · ×105libs/agno/agno/os/app.py:1753
Repeated repair: libs/agno/agno/os/routers/company/runs.py · ×7libs/agno/agno/os/routers/company/runs.py:38

What to do

  1. Resolve the 105 Hotspot finding(s) in Churn × Complexity Hotspots — start with router.py (4), REDACTED (4), workflow.py (3). — One of this dimension's main actionable groups (105 warning-level).
  2. Resolve the 7 Repeated repair finding(s) in Churn × Complexity Hotspots — start with runs.py, exceptions.py, knowledge.py. — One of this dimension's main actionable groups (7 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.3 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 9.3 / 10 · rule-coverage 100% · ceiling Documented

129 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is REDACTED. Counted over 1845 of the 3705 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×5
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt10.0 / 10Stronggated by 75 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

75 deducted task-comment markers across 611552 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×75libs/agno_infra/agno/utilities/git.py:29

What to do

  1. Resolve the 75 TodoComment finding(s) in Explicit Debt — start with _storage.py (24), REDACTED (5), workflow.py (3). — One of this dimension's main actionable groups (75 warning-level).
  2. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 390 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion2.5 / 10Weak✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic, LLM-independent.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

3 of 8 build units (Python, checkout, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D27 · Navigability10.0 / 10Exemplary✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

96 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)0.0 / 10Critical✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

13 finding(s): 0 critical, 13 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 7 REDACTED finding(s) in Secrets (history) — start with REDACTED (4), REDACTED, REDACTED. — One of this dimension's main actionable groups (7 issue-level).
  2. Resolve the 6 High secret finding(s) in Secrets (history) — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (6 issue-level).
  3. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

559 finding(s): 0 critical, 178 high, 94 medium, 287 low. 125 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 12 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 43 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (43). — One of this dimension's main actionable groups (43 issue-level).
  2. Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (6 issue-level).
  3. No action in Static Analysis (SAST) — all 125 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (125 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

59 finding(s): 20 critical, 24 high, 15 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 20 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (20). — One of this dimension's main actionable groups (20 issue-level).
  2. Resolve the 14 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (12), REDACTED (2). — One of this dimension's main actionable groups (14 issue-level).
  3. Resolve the 6 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security9.4 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Documented

4 finding(s): 0 critical, 1 high, 3 medium, 0 low.

REDACTED
REDACTED

What to do

  1. Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 3 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 warning-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness9.0 / 10Adequategated by 8 critical findings✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 9.0 / 10 · rule-coverage 100% · ceiling Documented

188 of 1845 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is libs/agno/agno/tools/shopify.py. Counted over 1845 of the 3705 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×8libs/agno/agno/tools/shopify.py:1
Orphaned file · ×180libs/agno/agno/tools/memory.py:1
Further orphaned files (smaller)

What to do

  1. Resolve the 8 Orphaned knowledge finding(s) in Knowledge Freshness — start with shopify.py, REDACTED, docling.py. — One of this dimension's main actionable groups (8 issue-level).
  2. Resolve the 180 Orphaned file finding(s) in Knowledge Freshness — start with schemas.py (5), REDACTED (3), config.py (2). — One of this dimension's main actionable groups (180 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: router.py↔router.py 96%; router.py↔router.py 65%; router.py↔router.py 58%

Change coupling clique: router.py, router.py, router.pylibs/agno/agno/os/routers/agents/router.py

What to do

  1. Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with router.py. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 5.0 / 10 · rule-coverage 100% · ceiling Documented

2/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
  2. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 0 platform declaration(s) and 159 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

AC2 · Forms & labels4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×9) — cookbook/05_agent_os/26_authorization/console.html:119, cookbook/05_agent_os/26_authorization/console.html:175, cookbook/05_agent_os/26_authorization/console.html:179, …
  • A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×2) — cookbook/data_labeling/image_search/public/index.html:72, cookbook/data_labeling/image_search/public/index.html:81
  • A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. — cookbook/data_labeling/image_search/public/index.html:250

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure6.0 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×2) — cookbook/07_knowledge/testing_resources/company_info.html:2, cookbook/data_labeling/image_search/public/index.html:2

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety4.1 / 10Weak✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • `th` sets color: white on background-color: #3498db — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — cookbook/07_knowledge/testing_resources/company_info.html:7
  • `.skel` moves (`animation: sk 1.4s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cookbook/data_labeling/image_search/public/index.html:14
  • `.card` moves (`transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cookbook/data_labeling/image_search/public/index.html:17
  • `.card img` moves (`transition: transform .3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cookbook/data_labeling/image_search/public/index.html:19
  • <i> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — cookbook/data_labeling/image_search/public/index.html:75

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

  • No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 6 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.

What to do

  • Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with vitest-axe in tests, then gate axe/pa11y/Lighthouse in CI.
AX10 · Code composition9.8 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX2 · Stateful singletons10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

C2 · Access Controls10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

M1 · Documentation (README)7.2 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 2 of 5 project(s) that lack one — worth up to 0.8 pts.
M2 · Architecture documentation2.0 / 10Critical✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure8.0 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

  • Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.

What to do

  • Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability8.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 3/9 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `cookbook/01_demo`, `cookbook/08_learning`, `cookbook/91_tools/mcp/mcp_toolbox_demo`, `cookbook/data_labeling/image_search`, `cookbook/gemini_3` and 1 more.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

  • No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 99232 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.

What to do

  • Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P5 · DR & Backup7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×23) — cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:34, cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:40, cookbook/02_agents/10_human_in_the_loop/confirmation_required.py:34, …
  • `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×13) — cookbook/02_agents/12_multimodal/audio_input_output.py:17, cookbook/02_agents/12_multimodal/audio_sentiment_analysis.py:29, cookbook/02_agents/12_multimodal/audio_to_text.py:23, …
  • `httpx.AsyncClient(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×4) — cookbook/05_agent_os/13_observability/filtering.py:93, cookbook/05_agent_os/13_observability/metrics.py:63, cookbook/05_agent_os/13_observability/read_traces.py:81, …

What to do

  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
P8 · Schema migrations3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

  • SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment. — REDACTED:202

What to do

  • Replace SQLAlchemy create_all() with Alembic (`alembic revision --autogenerate` + `alembic upgrade head`) so the production schema can evolve safely and reproducibly.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

  • `main` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. (×3) — cookbook/02_agents/18_checkpointing/01_crash_recovery.py:82, cookbook/03_teams/23_checkpointing/01_crash_recovery.py:81, cookbook/07_knowledge/09_archive/vector_dbs/lightrag.py:49
  • `run_async` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. (×2) — cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:237, cookbook/91_tools/zep_tools.py:66

What to do

  • Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.
R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

R10 · Code Duplication10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.

R2 · Cyclomatic Complexity5.0 / 10Adequate✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • P95 cyclomatic 10 · 0 function(s) > 10 · 0 > 20 (of 16)

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

R4 · Test Coverage10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

R8 · Dependency Hygiene7.5 / 10Strong✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Declared in cookbook/05_agent_os/16_agui/openui/frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×3)
  • Only test files import it (first: cookbook/05_agent_os/16_agui/openui/frontend/src/library.test.ts:1) — move it to devDependencies. — cookbook/05_agent_os/16_agui/openui/frontend/package.json:17

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

S1 · Web-Security Posture8.0 / 10Strong✓ Tool-verified

Other · Security — Only what this repository's own non-C# files could be read for was assessed — markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • `https://cdn.tailwindcss.com` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 3 such include(s) across the repository's markup. — cookbook/data_labeling/image_search/public/index.html:8

What to do

  • Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
X1 · Async correctness8.0 / 10Strong✓ Tool-verified

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

  • The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. (×3) — libs/agno/agno/workflow/workflow.py:2574, libs/agno/agno/workflow/workflow.py:2634, libs/agno/agno/tracing/exporter.py:112
  • This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`). (×5) — cookbook/91_tools/zep_tools.py:88, cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:244, cookbook/07_knowledge/09_archive/vector_dbs/lightrag.py:65, …

What to do

  • Task from `asyncio.create_task` is not kept
X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document2.8 / 10Weak✓ Tool-verified

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

  • `from_dict` is public and takes `data: Dict[str, Any]` from its caller, and it calls itself at line 646 (`self.from_dict`) with a piece of `data` — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/workflow/types.py:646
  • `scrub_workflow_media` is public and takes `run_response: Any` from its caller, and it calls itself at line 567 (`scrub_workflow_media`) with a piece of `run_response` — and nowhere in `scrub_workflow_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `scrub_workflow_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/agent.py:567
  • `check_type_compatibility` is public and takes `value: Any` from its caller, and it calls itself at line 77 (`check_type_compatibility`) with a piece of `value` — and nowhere in `check_type_compatibility` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `check_type_compatibility` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/common.py:77
  • `workflow_copy_divergence` is public, takes a document from its caller (line 53) and hands it to `_without_keys`, which calls itself at line 47 (`_without_keys`) with a piece of `value` (and at line 49) — and nowhere in `_without_keys` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_without_keys` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/copies.py:47
  • `has_additional_properties` is public and takes `schema: Any` from its caller, and it calls itself at line 117 (`has_additional_properties`) with a piece of `schema` (and at line 122) — and nowhere in `has_additional_properties` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `has_additional_properties` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/gemini.py:117
  • `has_self_reference` is public and takes `schema: Dict` from its caller, and it calls itself at line 138 (`has_self_reference`) with a piece of `schema` (and at line 143, line 150) — and nowhere in `has_self_reference` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `has_self_reference` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/gemini.py:138
  • `convert_schema` is public and takes `schema_dict: Dict[str, Any]` from its caller, and it calls itself at line 265 (`convert_schema`) with a piece of `schema_dict` (and at line 294, line 369, line 409) — and nowhere in `convert_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `convert_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/gemini.py:265
  • `inline_pydantic_schema` is public, takes a document from its caller (line 46) and hands it to `process_schema`, which calls itself at line 63 (`process_schema`) with a piece of `s` (and at line 80, line 85, line 88, line 92) — and nowhere in `process_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `process_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/json_schema.py:63
  • `get_json_schema_for_arg` is public and takes `type_hint: Any` from its caller, and it calls itself at line 111 (`get_json_schema_for_arg`) with a piece of `type_hint` (and at line 130, line 134, line 135, line 141, line 164) — and nowhere in `get_json_schema_for_arg` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `get_json_schema_for_arg` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/json_schema.py:111
  • `collect_opted_out_media_ids` is public and takes `run_response: Any` from its caller, and it calls itself at line 92 (`collect_opted_out_media_ids`) with a piece of `run_response` — and nowhere in `collect_opted_out_media_ids` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_opted_out_media_ids` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/media_offload.py:92
  • `offload_workflow_media` is public and takes `run_response: Any` from its caller, and it calls itself at line 654 (`offload_workflow_media`) with a piece of `run_response` — and nowhere in `offload_workflow_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `offload_workflow_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/media_offload.py:654
  • `aoffload_workflow_media` is public and takes `run_response: Any` from its caller, and it calls itself at line 691 (`aoffload_workflow_media`) with a piece of `run_response` — and nowhere in `aoffload_workflow_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `aoffload_workflow_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/media_offload.py:691
  • `iter_run_media` is public and takes `run: Any` from its caller, and it calls itself at line 775 (`iter_run_media`) with a piece of `run` (and at line 782, line 785) — and nowhere in `iter_run_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `iter_run_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/media_offload.py:775
  • `merge_dictionaries` is public and takes `a: Dict[str, Any]` from its caller, and it calls itself at line 18 (`merge_dictionaries`) with a piece of `a` — and nowhere in `merge_dictionaries` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `merge_dictionaries` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/merge_dict.py:18
  • `sanitize_response_schema` is public and takes `schema: dict` from its caller, and it calls itself at line 143 (`sanitize_response_schema`) with a piece of `schema` (and at line 147) — and nowhere in `sanitize_response_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `sanitize_response_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/utils/models/openai_responses.py:143
  • `from_dict` is public and takes `data: Dict[str, Any]` from its caller, and it calls itself at line 1002 (`self.from_dict`) with a piece of `data` — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/run/team.py:1002
  • `collect_mcp_tools_from_workflow_step` is public and takes `step: Any` from its caller, and it calls itself at line 2411 (`collect_mcp_tools_from_workflow_step`) with a piece of `step` — and nowhere in `collect_mcp_tools_from_workflow_step` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_mcp_tools_from_workflow_step` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/os/utils.py:2411
  • `collect_components_from_team` is public and takes `team: Any` from its caller, and it calls itself at line 2531 (`collect_components_from_team`) with a piece of `team` — and nowhere in `collect_components_from_team` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_components_from_team` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/os/utils.py:2531
  • `content_values_text` is public, takes a document from its caller (line 115) and hands it to `walk`, which calls itself at line 128 (`walk`) with a piece of `node` (and at line 131) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/learn/utils.py:128
  • `convert_any_metrics_in_data` is public and takes `data: Any` from its caller, and it calls itself at line 69 (`convert_any_metrics_in_data`) with a piece of `data` (and at line 75) — and nowhere in `convert_any_metrics_in_data` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `convert_any_metrics_in_data` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:69
  • `deserialize_from_dynamodb_item` is public and takes `item: Dict[str, Any]` from its caller, and it calls itself at line 108 (`deserialize_from_dynamodb_item`) with a piece of `item` — and nowhere in `deserialize_from_dynamodb_item` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `deserialize_from_dynamodb_item` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/db/dynamo/utils.py:108
  • `get_system_message` is public, takes a document from its caller (line 917) and hands it to `_learning_message_text`, which calls itself at line 901 (`_learning_message_text`) with a piece of `input` (and at line 903, line 911) — and nowhere in `_learning_message_text` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_learning_message_text` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — libs/agno/agno/agent/_messages.py:901
  • `find_approval_id` is public and takes `value: Any` from its caller, and it calls itself at line 110 (`find_approval_id`) with a piece of `value` (and at line 115) — and nowhere in `find_approval_id` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `find_approval_id` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — cookbook/05_agent_os/05_human_in_the_loop/team_approval.py:110

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation7.8 / 10Strong✓ Tool-verified

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

  • `debug` at line 153 is called with an argument built by `"…".join(command)` (line 153), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — libs/agno_infra/agno/docker/resource/image.py:153
  • `debug` at line 279 is called with an argument built by `container_context.model_dump_json(indent = 2)` (line 279), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — libs/agno_infra/agno/docker/app/base.py:279
  • `debug` at line 293 is called with an argument built by `"…".join(container_cmd)` (line 293), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — libs/agno_infra/agno/docker/app/base.py:293
  • `debug` at line 527 is called with an argument built by `"…".join(container_cmd)` (line 527), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — libs/agno_infra/agno/aws/app/base.py:527
  • `debug` at line 633 is called with an argument built by `container_context.model_dump_json(indent = 2)` (line 633), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — libs/agno_infra/agno/aws/app/base.py:633

What to do

  • In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X3 · Exception handling7.1 / 10Strong✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×7) — libs/agnoctl/agnoctl/http.py:96, libs/agno/agno/utils/agent.py:228, REDACTED:319, …
  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×33) — libs/agnoctl/agnoctl/http.py:147, libs/agnoctl/agnoctl/clients/__init__.py:80, libs/agno_infra/agno/aws/resource/cloudformation/stack.py:163, …

What to do

  • Swallowed exception (empty catch)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging4.4 / 10Weak✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `exception` at line 199 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/utils/http.py:199
  • `exception` at line 205 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/utils/http.py:205
  • `exception` at line 242 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/utils/http.py:242
  • `exception` at line 248 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/utils/http.py:248
  • `exception` at line 129 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/tools/twilio.py:129
  • `exception` at line 156 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/tools/twilio.py:156
  • `warning` at line 90 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/os/routers/session/session.py:90
  • `error` at line 207 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/os/routers/metrics/metrics.py:207
  • `exception` at line 781 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog. — libs/agno/agno/os/routers/memory/memory.py:781
  • `info` at line 50 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — cookbook/90_models/clients/http_client_caching.py:50
  • `info` at line 53 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — cookbook/90_models/clients/http_client_caching.py:53
  • `info` at line 131 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — cookbook/90_models/clients/http_client_caching.py:131
  • `info` at line 137 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — cookbook/90_models/clients/http_client_caching.py:137
  • `error` at line 142 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — cookbook/90_models/clients/http_client_caching.py:142

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types8.0 / 10Strong✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • ~5.1 `!` null assertions per 1k TypeScript source lines — 1 assertion(s) across the 198 source line(s) of the 4 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: cookbook/05_agent_os/16_agui/openui/frontend/src/main.tsx (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

WCAG coverage — what static analysis assessed

Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 42 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.1, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health62%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture94%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity62%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness36%Weak — gated by D13, P3, P7, P8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security72%Adequate — gated by D28, D29, D30Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling100%ExemplaryStrongest area.
Accessibility53%AdequateAcceptable, with room to improve.
Performance60%AdequateAcceptable, with room to improve.
Unscored — 3 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 8 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 44 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — no exported interface declares behaviour
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — compose up failed (exit 18 — an image could not be pulled) — db Pulling toolbox Pulling db Error Get "https://registry-1.docker.io/v2/": Forbidden toolbox Error context canceled Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the earlier `compose pull` step reported: toolbox Pulling db Pulling db Error Get "https://registry-1.docker.io/v2/": Forbidden toolbox Error context canceled Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the runtime sandbox reaches registries only through the in-fence pull-through mirror, so an image the mirror does not carry cannot be fetched — this is a limit of our sandbox, not of your stack; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or MongoEngine model, a migration or a SQL schema — and no database or data-store client (Django ORM, SQLAlchemy, psycopg, PyMongo, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not measured — JavaScript/TypeScript suite did not run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — Naming consistency is measured on C# only; Python, TypeScript, html not measured.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Aggregate roots were found in only one source directory (cookbook), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — cookbook/05_agent_os/16_agui/openui/frontend/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not applicable: Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 274 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 100 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 18 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · High CVE · ×20
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D13 · REDACTED Scanning · Leaked secret · ×16
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <input> without a programmatic label · ×9
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:119 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:175 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:179 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:180 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:191 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:192 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:208 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/05_agent_os/26_authorization/console.html:219 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cookbook/data_labeling/image_search/public/index.html:67 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
D34 · Knowledge Freshness · Orphaned knowledge · ×8
  • Orphaned knowledge libs/agno/agno/tools/shopify.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge REDACTED:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge libs/agno/agno/tools/docling.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge REDACTED:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge libs/agno/agno/tools/docker.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge libs/agno/agno/tools/gitlab.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge libs/agno/agno/client/a2a/client.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge libs/agno/agno/db/valkey/utils.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D28 · Secrets (history) · REDACTED · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · High secret · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High vulnerability · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <button> with no accessible text · ×2
  • <button> with no accessible text cookbook/data_labeling/image_search/public/index.html:72 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text cookbook/data_labeling/image_search/public/index.html:81 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
D14 · License Compliance · Banned license · ×2
  • Banned license: psycopg — `psycopg` 3.3.6 is published on PyPI under `LGPL-3.0-only`, which this policy bans, and it is in the SHIPPED closure of this repository — so it is installed by everything that depends on this repository, not just by its test environment. A distribution offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception.
  • Banned license: psycopg-binary — `psycopg-binary` 3.3.6 is published on PyPI under `LGPL-3.0-only`, which this policy bans, and it is in the SHIPPED closure of this repository — so it is installed by everything that depends on this repository, not just by its test environment. A distribution offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package, or record an accepted exception.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · Link with no accessible name · ×1
  • Link with no accessible name cookbook/data_labeling/image_search/public/index.html:250 — A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
D31 · IaC & Container Security · High IaC · ×1
  • REDACTED
Serious — 6614 finding(s)
D3 · God Classes · FileTooLong · ×152
  • FileTooLong: workflow/workflow.py libs/agno/agno/workflow/workflow.py — FileTooLong — 8420 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 7920 over it, 16.84× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: team/_run.py libs/agno/agno/team/_run.py — FileTooLong — 7208 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6708 over it, 14.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: postgres/postgres.py libs/agno/agno/db/postgres/postgres.py — FileTooLong — 6663 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6163 over it, 13.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 5899 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5399 over it, 11.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: postgres/async_postgres.py libs/agno/agno/db/postgres/async_postgres.py — FileTooLong — 5008 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4508 over it, 10.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 4403 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3903 over it, 8.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: agent/_run.py libs/agno/agno/agent/_run.py — FileTooLong — 4365 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3865 over it, 8.73× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: knowledge/knowledge.py libs/agno/agno/knowledge/knowledge.py — FileTooLong — 4107 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3607 over it, 8.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tools/studio.py libs/agno/agno/tools/studio.py — FileTooLong — 3772 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3272 over it, 7.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: workflow/step.py libs/agno/agno/workflow/step.py — FileTooLong — 2610 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2110 over it, 5.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: stores/entity_memory.py libs/agno/agno/learn/stores/entity_memory.py — FileTooLong — 2608 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2108 over it, 5.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mongo/async_mongo.py libs/agno/agno/db/mongo/async_mongo.py — FileTooLong — 2470 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1970 over it, 4.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mongo/mongo.py libs/agno/agno/db/mongo/mongo.py — FileTooLong — 2357 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1857 over it, 4.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: db/base.py libs/agno/agno/db/base.py — FileTooLong — 2344 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1844 over it, 4.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 2177 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1677 over it, 4.35× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mysql/async_mysql.py libs/agno/agno/db/mysql/async_mysql.py — FileTooLong — 2107 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1607 over it, 4.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: dynamo/dynamo.py libs/agno/agno/db/dynamo/dynamo.py — FileTooLong — 2094 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1594 over it, 4.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mysql/mysql.py libs/agno/agno/db/mysql/mysql.py — FileTooLong — 2054 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1554 over it, 4.11× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: valkey/valkey.py libs/agno/agno/db/valkey/valkey.py — FileTooLong — 2035 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1535 over it, 4.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED libs/agno/agno/db/singlestore/singlestore.py — FileTooLong — 2031 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1531 over it, 4.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: redis/redis.py libs/agno/agno/db/redis/redis.py — FileTooLong — 2030 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1530 over it, 4.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: os/app.py libs/agno/agno/os/app.py — FileTooLong — 2020 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1520 over it, 4.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: workflows/router.py libs/agno/agno/os/routers/workflows/router.py — FileTooLong — 2019 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1519 over it, 4.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: agents/router.py libs/agno/agno/os/routers/agents/router.py — FileTooLong — 1992 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1492 over it, 3.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: os/utils.py libs/agno/agno/os/utils.py — FileTooLong — 1988 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1488 over it, 3.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 127 more in this group — see findings.md.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×112
  • Members sharing a duplicated core (4 members, 50+ identical tokens) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:103 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:103-118 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:88-101 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:108-119 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:176-191 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:70 — cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:70-124 | cookbook/05_agent_os/05_human_in_the_loop/basic.py:66-104 | cookbook/05_agent_os/05_human_in_the_loop/external_execution.py:95-131 | cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py:85-128 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) cookbook/05_agent_os/21_factories/01_basic.py:81 — cookbook/05_agent_os/21_factories/01_basic.py:81-115 | cookbook/05_agent_os/21_factories/02_with_input_schema.py:74-123 | cookbook/05_agent_os/21_factories/05_team_factory.py:91-125 | cookbook/05_agent_os/21_factories/06_workflow_factory.py:95-128 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:110 — cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:110-123 | cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py:85-98 | cookbook/07_knowledge/09_archive/vector_dbs/mongo_db.py:114-127 | cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py:95-108 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) cookbook/91_tools/mcp/pipedream_auth.py:47 — cookbook/91_tools/mcp/pipedream_auth.py:47-58 | cookbook/91_tools/mcp/pipedream_google_calendar.py:29-40 | cookbook/91_tools/mcp/pipedream_linkedin.py:29-40 | cookbook/91_tools/mcp/pipedream_slack.py:30-41 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/_managers.py:34 — libs/agno/agno/agent/_managers.py:34-81 | libs/agno/agno/agent/_managers.py:89-136 | libs/agno/agno/team/_managers.py:33-50 | libs/agno/agno/team/_managers.py:58-75 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/_response.py:259 — libs/agno/agno/agent/_response.py:259-286 | libs/agno/agno/agent/_response.py:296-324 | libs/agno/agno/team/_response.py:733-758 | libs/agno/agno/team/_response.py:768-794 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/_response.py:452 — libs/agno/agno/agent/_response.py:452-510 | libs/agno/agno/agent/_response.py:520-579 | libs/agno/agno/team/_response.py:241-302 | libs/agno/agno/team/_response.py:312-374 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/_run.py:1347 — libs/agno/agno/agent/_run.py:1347-1510 | libs/agno/agno/agent/_run.py:2738-2940 | libs/agno/agno/team/_run.py:1927-2114 | libs/agno/agno/team/_run.py:4158-4345 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/_run.py:1971 — libs/agno/agno/agent/_run.py:1971-2022 | libs/agno/agno/agent/_run.py:2041-2120 | libs/agno/agno/team/_run.py:3466-3517 | libs/agno/agno/team/_run.py:3536-3613 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/agent/agent.py:1869 — libs/agno/agno/agent/agent.py:1869-1940 | libs/agno/agno/team/team.py:1896-1982 | libs/agno/agno/workflow/workflow.py:1505-1563 | libs/agno/agno/workflow/workflow.py:11927-12013 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/client/os.py:108 — libs/agno/agno/client/os.py:108-157 | libs/agno/agno/client/os.py:168-217 | libs/agno/agno/client/os.py:335-369 | libs/agno/agno/client/os.py:2400-2442 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/firestore/firestore.py:427 — libs/agno/agno/db/firestore/firestore.py:427-469 | libs/agno/agno/db/firestore/firestore.py:755-862 | libs/agno/agno/db/firestore/firestore.py:1296-1360 | libs/agno/agno/db/firestore/firestore.py:2047-2139 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/gcs_json/gcs_json_db.py:1752 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1752-1829 | libs/agno/agno/db/json/json_db.py:1852-1929 | libs/agno/agno/db/redis/redis.py:2136-2213 | libs/agno/agno/db/valkey/valkey.py:2615-2699 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED:3503 — REDACTED:3503-3579 | REDACTED:3583-3658 | REDACTED:4290-4349 | REDACTED:4353-4408 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py:2777 — libs/agno/agno/db/mongo/async_mongo.py:2777-2860 | libs/agno/agno/db/mongo/async_mongo.py:2874-2979 | libs/agno/agno/db/mongo/mongo.py:2641-2724 | libs/agno/agno/db/mongo/mongo.py:2738-2843 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py:2874 — libs/agno/agno/db/mongo/async_mongo.py:2874-2979 | libs/agno/agno/db/mongo/mongo.py:2738-2843 | libs/agno/agno/db/mysql/async_mysql.py:3124-3227 | libs/agno/agno/db/mysql/mysql.py:3088-3189 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:2399 — libs/agno/agno/db/mysql/async_mysql.py:2399-2480 | libs/agno/agno/db/mysql/mysql.py:2371-2452 | libs/agno/agno/db/postgres/async_postgres.py:2744-2838 | libs/agno/agno/db/postgres/postgres.py:3289-3380 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:827 — libs/agno/agno/db/mysql/mysql.py:827-839 | libs/agno/agno/db/postgres/postgres.py:1325-1354 | libs/agno/agno/db/singlestore/singlestore.py:883-894 | REDACTED:1319-1343 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:842 — libs/agno/agno/db/mysql/mysql.py:842-853 | libs/agno/agno/db/postgres/postgres.py:1357-1379 | libs/agno/agno/db/singlestore/singlestore.py:897-907 | REDACTED:1346-1364 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:898 — libs/agno/agno/db/mysql/mysql.py:898-932 | libs/agno/agno/db/postgres/postgres.py:1460-1524 | libs/agno/agno/db/singlestore/singlestore.py:952-987 | REDACTED:1440-1502 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:1531 — libs/agno/agno/db/mysql/mysql.py:1531-1561 | libs/agno/agno/db/postgres/postgres.py:2382-2415 | libs/agno/agno/db/singlestore/singlestore.py:1575-1606 | REDACTED:2324-2355 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:2250 — libs/agno/agno/db/mysql/mysql.py:2250-2271 | libs/agno/agno/db/postgres/postgres.py:3158-3178 | libs/agno/agno/db/singlestore/singlestore.py:2277-2297 | REDACTED:3078-3100 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:2274 — libs/agno/agno/db/mysql/mysql.py:2274-2302 | libs/agno/agno/db/postgres/postgres.py:3181-3208 | libs/agno/agno/db/singlestore/singlestore.py:2300-2325 | REDACTED:3103-3132 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) libs/agno/agno/db/mysql/mysql.py:2371 — libs/agno/agno/db/mysql/mysql.py:2371-2452 | libs/agno/agno/db/postgres/postgres.py:3289-3380 | libs/agno/agno/db/singlestore/singlestore.py:2395-2444 | REDACTED:3198-3250 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • + 87 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×110
  • Duplicated block (11 lines × 2) cookbook/02_agents/15_dependencies/dependencies_in_tools.py:55 — cookbook/02_agents/15_dependencies/dependencies_in_tools.py:55-67 | cookbook/03_teams/17_dependencies/dependencies_in_tools.py:73-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/15_dependencies/dependencies_in_tools.py:55` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) cookbook/02_agents/18_checkpointing/01_crash_recovery.py:86 — cookbook/02_agents/18_checkpointing/01_crash_recovery.py:86-96 | cookbook/03_teams/23_checkpointing/01_crash_recovery.py:85-95 — before extracting anything, compare `cookbook/02_agents/18_checkpointing/01_crash_recovery.py` and `cookbook/03_teams/23_checkpointing/01_crash_recovery.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) cookbook/05_agent_os/04_run_lifecycle/background_run.py:59 — cookbook/05_agent_os/04_run_lifecycle/background_run.py:59-69 | cookbook/05_agent_os/04_run_lifecycle/cancel_run.py:59-69 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:222 — cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:222-232 | cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:248-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) libs/agno/agno/agent/_init.py:505 — libs/agno/agno/agent/_init.py:505-515 | libs/agno/agno/team/_init.py:916-926 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) libs/agno/agno/agent/_response.py:239 — libs/agno/agno/agent/_response.py:239-249 | libs/agno/agno/team/_response.py:652-662 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `TeamRunOutput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) libs/agno/agno/agent/_response.py:777 — libs/agno/agno/agent/_response.py:777-787 | libs/agno/agno/agent/_response.py:816-826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) libs/agno/agno/agent/_run.py:4241 — libs/agno/agno/agent/_run.py:4241-4251 | libs/agno/agno/team/_run.py:9166-9176 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) libs/agno/agno/client/a2a/utils.py:68 — libs/agno/agno/client/a2a/utils.py:68-78 | libs/agno/agno/client/a2a/utils.py:213-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/client/a2a/utils.py:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) libs/agno/agno/cloud/aws/s3/object.py:47 — libs/agno/agno/cloud/aws/s3/object.py:47-57 | libs/agno_infra/agno/aws/resource/s3/object.py:51-61 — before extracting anything, compare `libs/agno/agno/cloud/aws/s3/object.py` and `libs/agno_infra/agno/aws/resource/s3/object.py` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `AwsApiClient` names `agno.aws.api_client` in one and `agno.cloud.aws.s3.api_client` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) libs/agno/agno/company/manager.py:484 — libs/agno/agno/company/manager.py:484-494 | libs/agno/agno/company/manager.py:1379-1389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) libs/agno/agno/compression/manager.py:160 — libs/agno/agno/compression/manager.py:160-170 | libs/agno/agno/compression/manager.py:270-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) libs/agno/agno/context/calendar/provider.py:213 — libs/agno/agno/context/calendar/provider.py:213-223 | libs/agno/agno/context/gmail/provider.py:228-238 — `libs/agno/agno/context/calendar/provider.py` and `libs/agno/agno/context/gmail/provider.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 60 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:881 — libs/agno/agno/db/dynamo/dynamo.py:881-891 | libs/agno/agno/db/dynamo/dynamo.py:2405-2415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/firestore/firestore.py:828 — libs/agno/agno/db/firestore/firestore.py:828-838 | libs/agno/agno/db/firestore/firestore.py:1342-1352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1406 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1406-1416 | libs/agno/agno/db/json/json_db.py:1500-1510 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/json/json_db.py:1512` calls `log_debug` and `libs/agno/agno/db/gcs_json/gcs_json_db.py:1418` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) REDACTED:540 — REDACTED:540-558 | REDACTED:614-624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) REDACTED:885 — REDACTED:885-895 | REDACTED:3667-3677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) REDACTED:1021 — REDACTED:1021-1031 | REDACTED:1118-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) REDACTED:1074 — REDACTED:1074-1084 | REDACTED:1168-1178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) REDACTED:1865 — REDACTED:1865-1875 | REDACTED:1957-1967 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1126 — libs/agno/agno/db/mongo/async_mongo.py:1126-1136 | libs/agno/agno/db/mongo/mongo.py:937-947 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3065 — libs/agno/agno/db/mongo/async_mongo.py:3065-3075 | libs/agno/agno/db/mongo/mongo.py:2929-2939 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3167 — libs/agno/agno/db/mongo/async_mongo.py:3167-3177 | libs/agno/agno/db/mongo/async_mongo.py:3371-3381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:770 — libs/agno/agno/db/postgres/async_postgres.py:770-780 | libs/agno/agno/db/postgres/postgres.py:925-935 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 85 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×105
  • Hotspot: libs/agno/agno/os/app.py libs/agno/agno/os/app.py:1753 — libs/agno/agno/os/app.py changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in AgentOS.get_app at line 1753. 13 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/app.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/workflow/workflow.py libs/agno/agno/workflow/workflow.py:9566 — libs/agno/agno/workflow/workflow.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 164 in Workflow._acontinue_execute_stream at line 9566. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/workflow/workflow.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/agent/_storage.py libs/agno/agno/agent/_storage.py:833 — libs/agno/agno/agent/_storage.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 144 in _storage.to_dict at line 833. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/agent/_storage.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/db/postgres/postgres.py libs/agno/agno/db/postgres/postgres.py:382 — libs/agno/agno/db/postgres/postgres.py changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in PostgresDb._create_table at line 382. 12 of those changes were fix/bug commits, and the other 20 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/db/postgres/postgres.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/team/_storage.py libs/agno/agno/team/_storage.py:513 — libs/agno/agno/team/_storage.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 141 in _storage.to_dict at line 513. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/team/_storage.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/agents/base.py libs/agno/agno/agents/base.py:1869 — libs/agno/agno/agents/base.py changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in BaseExternalAgent._arun_stream at line 1869. 9 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/agents/base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/os/job_queue.py libs/agno/agno/os/job_queue.py:2107 — libs/agno/agno/os/job_queue.py changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in QueueWorker._execute_claimed_inner at line 2107. 8 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/job_queue.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/agent/_run.py libs/agno/agno/agent/_run.py:5190 — libs/agno/agno/agent/_run.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in _run._acontinue_run_stream at line 5190. 5 of those changes were fix/bug commits, and the other 6 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/agent/_run.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/team/_run.py libs/agno/agno/team/_run.py:9803 — libs/agno/agno/team/_run.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in _run._acontinue_run_stream at line 9803. 4 of those changes were fix/bug commits, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/team/_run.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/workflow/step.py libs/agno/agno/workflow/step.py:2080 — libs/agno/agno/workflow/step.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in Step.aexecute_stream at line 2080. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/workflow/step.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/db/postgres/async_postgres.py libs/agno/agno/db/postgres/async_postgres.py:343 — libs/agno/agno/db/postgres/async_postgres.py changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in AsyncPostgresDb._create_table at line 343. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/db/postgres/async_postgres.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:2063 — REDACTED changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in SqliteDb.upsert_sessions at line 2063. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/os/routers/workflows/router.py libs/agno/agno/os/routers/workflows/router.py:269 — libs/agno/agno/os/routers/workflows/router.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in router.handle_workflow_via_websocket at line 269. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/routers/workflows/router.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:1806 — REDACTED changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in AsyncSqliteDb.upsert_sessions at line 1806. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/tools/function.py libs/agno/agno/tools/function.py:586 — libs/agno/agno/tools/function.py changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in function._derive_entrypoint_schema at line 586. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/tools/function.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/os/utils.py libs/agno/agno/os/utils.py:141 — libs/agno/agno/os/utils.py changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in utils.get_request_kwargs at line 141. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/utils.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/knowledge/knowledge.py libs/agno/agno/knowledge/knowledge.py:2544 — libs/agno/agno/knowledge/knowledge.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in Knowledge._aload_from_url at line 2544. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/knowledge/knowledge.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/db/base.py libs/agno/agno/db/base.py:305 — libs/agno/agno/db/base.py changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in BaseDb.__init__ at line 305. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/db/base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/agents/codex/agent.py libs/agno/agno/agents/codex/agent.py:974 — libs/agno/agno/agents/codex/agent.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in CodexAgent._translate_notification at line 974. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/agents/codex/agent.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/os/middleware/jwt.py libs/agno/agno/os/middleware/jwt.py:1464 — libs/agno/agno/os/middleware/jwt.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in AuthMiddleware._dispatch at line 1464. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/middleware/jwt.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/os/mcp.py libs/agno/agno/os/mcp.py:1934 — libs/agno/agno/os/mcp.py changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in mcp._register_exposed_components at line 1934. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/mcp.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/agent/_messages.py libs/agno/agno/agent/_messages.py:1213 — libs/agno/agno/agent/_messages.py changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in _messages.aget_system_message at line 1213. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/agent/_messages.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/company/routines.py libs/agno/agno/company/routines.py:772 — libs/agno/agno/company/routines.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in _CompanyScheduleExecutor._accept at line 772. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/company/routines.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/tools/studio.py libs/agno/agno/tools/studio.py:271 — libs/agno/agno/tools/studio.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in StudioTools.__init__ at line 271. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/tools/studio.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: libs/agno/agno/agents/claude/agent.py libs/agno/agno/agents/claude/agent.py:728 — libs/agno/agno/agents/claude/agent.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in ClaudeAgent._build_continuation at line 728. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/agents/claude/agent.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 80 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×99
  • Duplicated block (13 lines × 2) cookbook/02_agents/11_approvals/approval_async.py:76 — cookbook/02_agents/11_approvals/approval_async.py:76-88 | cookbook/02_agents/11_approvals/audit_approval_async.py:64-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/11_approvals/approval_async.py:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) cookbook/03_teams/14_run_control/cancel_run.py:24 — cookbook/03_teams/14_run_control/cancel_run.py:24-36 | cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py:25-37 — before extracting anything, compare `cookbook/03_teams/14_run_control/cancel_run.py` and `cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 113 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:137 — cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:137-149 | cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:169-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) cookbook/05_agent_os/05_human_in_the_loop/user_input.py:139 — cookbook/05_agent_os/05_human_in_the_loop/user_input.py:139-151 | cookbook/05_agent_os/05_human_in_the_loop/workflow_hitl.py:175-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/05_human_in_the_loop/user_input.py:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) cookbook/12_context/02_web_exa_mcp.py:37 — cookbook/12_context/02_web_exa_mcp.py:37-49 | cookbook/12_context/11_web_parallel_mcp.py:39-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/12_context/02_web_exa_mcp.py:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) cookbook/12_context/14_wiki_filesystem.py:70 — cookbook/12_context/14_wiki_filesystem.py:70-82 | cookbook/12_context/15_wiki_git.py:92-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cookbook/12_context/15_wiki_git.py:91` calls `asetup` and `cookbook/12_context/14_wiki_filesystem.py:69` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) cookbook/91_tools/mcp/sse_transport/client.py:24 — cookbook/91_tools/mcp/sse_transport/client.py:24-36 | cookbook/91_tools/mcp/streamable_http_transport/client.py:23-35 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:202 — cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:202-214 | cookbook/data_labeling/_19_inter_annotator_agreement/jury_votes.py:238-250 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_init.py:535 — libs/agno/agno/agent/_init.py:535-547 | libs/agno/agno/team/_init.py:948-960 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_managers.py:272 — libs/agno/agno/agent/_managers.py:272-286 | libs/agno/agno/team/_managers.py:199-211 — `libs/agno/agno/agent/_managers.py` and `libs/agno/agno/team/_managers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 100 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_managers.py:272` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_messages.py:2570 — libs/agno/agno/agent/_messages.py:2570-2583 | libs/agno/agno/agent/_messages.py:2679-2691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_response.py:334 — libs/agno/agno/agent/_response.py:334-346 | libs/agno/agno/team/_response.py:135-147 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_run.py:697 — libs/agno/agno/agent/_run.py:697-709 | libs/agno/agno/agent/_run.py:1231-1243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_run.py:1067 — libs/agno/agno/agent/_run.py:1067-1079 | libs/agno/agno/agent/_run.py:1117-1129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_run.py:1893 — libs/agno/agno/agent/_run.py:1893-1905 | libs/agno/agno/team/_run.py:3395-3407 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1893` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_run.py:2428 — libs/agno/agno/agent/_run.py:2428-2440 | libs/agno/agno/agent/_run.py:2471-2483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2428` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_run.py:2876 — libs/agno/agno/agent/_run.py:2876-2888 | libs/agno/agno/agent/_run.py:2909-2921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/_storage.py:1288 — libs/agno/agno/agent/_storage.py:1288-1300 | libs/agno/agno/team/_storage.py:1190-1202 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) libs/agno/agno/agent/agent.py:2021 — libs/agno/agno/agent/agent.py:2021-2033 | libs/agno/agno/workflow/workflow.py:12097-12109 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) libs/agno/agno/cloud/aws/s3/api_client.py:21 — libs/agno/agno/cloud/aws/s3/api_client.py:21-33 | libs/agno_infra/agno/aws/api_client.py:21-33 — before extracting anything, compare `libs/agno/agno/cloud/aws/s3/api_client.py` and `libs/agno_infra/agno/aws/api_client.py` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) libs/agno/agno/db/filter_converter.py:115 — libs/agno/agno/db/filter_converter.py:115-127 | libs/agno/agno/db/valkey/utils.py:284-296 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) libs/agno/agno/db/in_memory/in_memory_db.py:1079 — libs/agno/agno/db/in_memory/in_memory_db.py:1079-1091 | libs/agno/agno/db/json/json_db.py:1333-1345 — `libs/agno/agno/db/in_memory/in_memory_db.py` and `libs/agno/agno/db/json/json_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 360 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) REDACTED:3172 — REDACTED:3172-3184 | REDACTED:4109-4121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3168` calls `_user_id_column_ddl` and `REDACTED:4107` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) REDACTED:3882 — REDACTED:3882-3894 | REDACTED:3954-3966 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3967` calls `join`, `quote_db_identifier` and `REDACTED:3895` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1044 — libs/agno/agno/db/mongo/async_mongo.py:1044-1056 | libs/agno/agno/db/mongo/mongo.py:855-867 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 74 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×95
  • Duplicated block (14 lines × 2) cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:79 — cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:79-92 | cookbook/03_teams/23_checkpointing/02_tool_error_persistence.py:69-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) cookbook/03_teams/25_time_travel/02_fork_run.py:30 — cookbook/03_teams/25_time_travel/02_fork_run.py:30-43 | cookbook/03_teams/26_fork_session/01_fork_session.py:39-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:125 — cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:125-138 | cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:182-195 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:125` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) cookbook/05_agent_os/05_human_in_the_loop/basic.py:70 — cookbook/05_agent_os/05_human_in_the_loop/basic.py:70-83 | cookbook/05_agent_os/05_human_in_the_loop/external_execution.py:99-115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/05_human_in_the_loop/basic.py:70` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) cookbook/10_reasoning/teams/knowledge_tool_team.py:40 — cookbook/10_reasoning/teams/knowledge_tool_team.py:40-53 | cookbook/10_reasoning/teams/reasoning_finance_team.py:22-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/10_reasoning/teams/knowledge_tool_team.py:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) cookbook/performance/comparison/long_conversation_comparison.py:152 — cookbook/performance/comparison/long_conversation_comparison.py:152-165 | cookbook/performance/comparison/multi_turn_comparison.py:172-185 — before extracting anything, compare `cookbook/performance/comparison/long_conversation_comparison.py` and `cookbook/performance/comparison/multi_turn_comparison.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_cli.py:268 — libs/agno/agno/agent/_cli.py:268-281 | libs/agno/agno/agent/_cli.py:314-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_cli.py:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_init.py:561 — libs/agno/agno/agent/_init.py:561-574 | libs/agno/agno/team/_init.py:974-987 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_response.py:356 — libs/agno/agno/agent/_response.py:356-369 | libs/agno/agno/agent/_response.py:404-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_run.py:274 — libs/agno/agno/agent/_run.py:274-287 | libs/agno/agno/agent/_run.py:339-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_run.py:1262 — libs/agno/agno/agent/_run.py:1262-1276 | libs/agno/agno/team/_run.py:1855-1868 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:1854` calls `_cleanup_and_store` and `libs/agno/agno/agent/_run.py:1262` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_run.py:1840 — libs/agno/agno/agent/_run.py:1840-1853 | libs/agno/agno/agent/_run.py:5069-5082 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_run.py:2074 — libs/agno/agno/agent/_run.py:2074-2087 | libs/agno/agno/team/_run.py:3568-3581 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2074` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_run.py:3810 — libs/agno/agno/agent/_run.py:3810-3823 | libs/agno/agno/agent/_run.py:5078-5091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:3810` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/agent/_storage.py:937 — libs/agno/agno/agent/_storage.py:937-950 | libs/agno/agno/team/_storage.py:774-787 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_storage.py:953` calls `hasattr`, `to_dict` and `libs/agno/agno/team/_storage.py:790` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) libs/agno/agno/client/os.py:140 — libs/agno/agno/client/os.py:140-153 | libs/agno/agno/client/os.py:200-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/client/os.py:140` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/compression/manager.py:90 — libs/agno/agno/compression/manager.py:90-103 | libs/agno/agno/compression/manager.py:194-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/compression/manager.py:110 — libs/agno/agno/compression/manager.py:110-123 | libs/agno/agno/compression/manager.py:215-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/db/base.py:361 — libs/agno/agno/db/base.py:361-374 | libs/agno/agno/db/base.py:2692-2705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) REDACTED:766 — REDACTED:766-779 | REDACTED:995-1009 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:3514 — REDACTED:3514-3527 | REDACTED:4300-4313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:3589 — REDACTED:3589-3602 | REDACTED:4359-4372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2847 — libs/agno/agno/db/mongo/async_mongo.py:2847-2860 | libs/agno/agno/db/mongo/mongo.py:2711-2724 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:2847` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1762 — libs/agno/agno/db/mysql/async_mysql.py:1762-1775 | libs/agno/agno/db/postgres/async_postgres.py:2158-2171 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2729 — libs/agno/agno/db/mysql/async_mysql.py:2729-2742 | libs/agno/agno/db/postgres/async_postgres.py:3105-3118 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2729` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 70 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×95
  • Duplicated block (8 lines × 2) cookbook/02_agents/05_state_and_session/metadata_resolution.py:57 — cookbook/02_agents/05_state_and_session/metadata_resolution.py:57-64 | cookbook/04_workflows/06_advanced_concepts/run_params/metadata_resolution.py:71-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/05_state_and_session/metadata_resolution.py:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) cookbook/04_workflows/08_human_in_the_loop/condition/02_condition_on_error.py:73 — cookbook/04_workflows/08_human_in_the_loop/condition/02_condition_on_error.py:73-80 | cookbook/04_workflows/08_human_in_the_loop/condition/02_condition_on_error.py:152-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) cookbook/performance/comparison/long_conversation_comparison.py:89 — cookbook/performance/comparison/long_conversation_comparison.py:89-96 | cookbook/performance/comparison/multi_turn_comparison.py:109-116 — before extracting anything, compare `cookbook/performance/comparison/long_conversation_comparison.py` and `cookbook/performance/comparison/multi_turn_comparison.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) libs/agno/agno/agent/_init.py:173 — libs/agno/agno/agent/_init.py:173-180 | libs/agno/agno/team/_init.py:594-601 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) libs/agno/agno/agent/_init.py:458 — libs/agno/agno/agent/_init.py:458-465 | libs/agno/agno/team/_init.py:825-832 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) libs/agno/agno/agent/_storage.py:801 — libs/agno/agno/agent/_storage.py:801-808 | libs/agno/agno/team/_telemetry.py:14-21 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) libs/agno/agno/agent/_storage.py:957 — libs/agno/agno/agent/_storage.py:957-964 | libs/agno/agno/team/_storage.py:790-797 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_storage.py:953` calls `hasattr`, `to_dict` and `libs/agno/agno/team/_storage.py:787` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) libs/agno/agno/agent/_storage.py:1459 — libs/agno/agno/agent/_storage.py:1459-1466 | libs/agno/agno/team/_storage.py:1334-1341 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) libs/agno/agno/agents/base.py:1781 — libs/agno/agno/agents/base.py:1781-1788 | libs/agno/agno/agents/base.py:1884-1891 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/base.py:497 — libs/agno/agno/db/base.py:497-504 | REDACTED:268-275 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:1009 — libs/agno/agno/db/dynamo/dynamo.py:1009-1018 | libs/agno/agno/db/surrealdb/surrealdb.py:812-819 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/dynamo/utils.py:549 — libs/agno/agno/db/dynamo/utils.py:549-556 | libs/agno/agno/db/dynamo/utils.py:700-707 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:783 — libs/agno/agno/db/gcs_json/gcs_json_db.py:783-790 | libs/agno/agno/db/json/json_db.py:836-843 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) REDACTED:985 — REDACTED:985-992 | REDACTED:1035-1042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `BaseDb` in one and `AsyncBaseDb` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) REDACTED:2825 — REDACTED:2825-2832 | REDACTED:2906-2913 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) REDACTED:3548 — REDACTED:3548-3555 | REDACTED:3628-3635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3548` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `BaseDb` in one and `AsyncBaseDb` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:776 — libs/agno/agno/db/mongo/async_mongo.py:776-784 | libs/agno/agno/db/mongo/async_mongo.py:1616-1623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mongo/async_mongo.py:773` calls `sort`, `apply_pagination` and `libs/agno/agno/db/mongo/async_mongo.py:1615` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1930 — libs/agno/agno/db/mongo/async_mongo.py:1930-1937 | libs/agno/agno/db/mongo/mongo.py:1737-1744 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2266 — libs/agno/agno/db/mongo/async_mongo.py:2266-2273 | libs/agno/agno/db/mongo/mongo.py:2071-2078 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:612 — libs/agno/agno/db/mysql/async_mysql.py:612-619 | REDACTED:864-871 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:612` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/mysql/mysql.py:256 — libs/agno/agno/db/mysql/mysql.py:256-263 | libs/agno/agno/db/postgres/postgres.py:541-551 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:541` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1494 — libs/agno/agno/db/postgres/async_postgres.py:1494-1501 | REDACTED:1420-1427 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3100 — libs/agno/agno/db/postgres/async_postgres.py:3100-3107 | libs/agno/agno/db/postgres/postgres.py:3644-3651 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5205 — libs/agno/agno/db/postgres/async_postgres.py:5205-5212 | libs/agno/agno/db/postgres/postgres.py:7905-7912 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5407 — libs/agno/agno/db/postgres/async_postgres.py:5407-5414 | libs/agno/agno/db/postgres/postgres.py:8098-8105 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5407` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 70 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×92
  • Duplicated block (12 lines × 2) cookbook/03_teams/25_time_travel/01_continue_from.py:53 — cookbook/03_teams/25_time_travel/01_continue_from.py:53-64 | cookbook/03_teams/25_time_travel/01_continue_from.py:66-77 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) cookbook/04_workflows/05_conditional_branching/selector_types.py:96 — cookbook/04_workflows/05_conditional_branching/selector_types.py:96-107 | cookbook/04_workflows/05_conditional_branching/step_choices_parameter.py:46-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) cookbook/performance/comparison/long_conversation_comparison.py:47 — cookbook/performance/comparison/long_conversation_comparison.py:47-58 | cookbook/performance/comparison/multi_turn_comparison.py:67-78 — before extracting anything, compare `cookbook/performance/comparison/long_conversation_comparison.py` and `cookbook/performance/comparison/multi_turn_comparison.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_managers.py:36 — libs/agno/agno/agent/_managers.py:36-47 | libs/agno/agno/team/_managers.py:35-46 — `libs/agno/agno/agent/_managers.py` and `libs/agno/agno/team/_managers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 100 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_managers.py:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_managers.py:91 — libs/agno/agno/agent/_managers.py:91-102 | libs/agno/agno/team/_managers.py:60-71 — `libs/agno/agno/agent/_managers.py` and `libs/agno/agno/team/_managers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 100 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_managers.py:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_response.py:919 — libs/agno/agno/agent/_response.py:919-930 | libs/agno/agno/team/_response.py:1690-1701 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_response.py:1559 — libs/agno/agno/agent/_response.py:1559-1570 | libs/agno/agno/team/_response.py:1511-1522 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:1559` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_response.py:1842 — libs/agno/agno/agent/_response.py:1842-1853 | libs/agno/agno/agent/_response.py:1864-1875 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_run.py:3147 — libs/agno/agno/agent/_run.py:3147-3158 | libs/agno/agno/team/_run.py:7100-7111 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_run.py:4530 — libs/agno/agno/agent/_run.py:4530-4541 | libs/agno/agno/team/_run.py:8811-8822 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_run.py:5929 — libs/agno/agno/agent/_run.py:5929-5940 | libs/agno/agno/team/_run.py:4436-4447 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) libs/agno/agno/agent/_storage.py:1303 — libs/agno/agno/agent/_storage.py:1303-1314 | libs/agno/agno/team/_storage.py:1207-1218 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) libs/agno/agno/client/a2a/client.py:380 — libs/agno/agno/client/a2a/client.py:380-391 | libs/agno/agno/client/a2a/client.py:489-500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) libs/agno/agno/client/a2a/client.py:516 — libs/agno/agno/client/a2a/client.py:516-527 | libs/agno/agno/client/a2a/client.py:543-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/filter_converter.py:134 — libs/agno/agno/db/filter_converter.py:134-145 | libs/agno/agno/db/valkey/utils.py:303-314 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/filter_converter.py:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1552 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1552-1563 | libs/agno/agno/db/json/json_db.py:1652-1663 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/json/json_db.py:1665` calls `log_debug` and `libs/agno/agno/db/gcs_json/gcs_json_db.py:1565` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/json/json_db.py:1285 — libs/agno/agno/db/json/json_db.py:1285-1296 | libs/agno/agno/db/valkey/valkey.py:1772-1783 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:768 — libs/agno/agno/db/mongo/async_mongo.py:768-779 | libs/agno/agno/db/mongo/mongo.py:572-583 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2744 — libs/agno/agno/db/mongo/async_mongo.py:2744-2755 | libs/agno/agno/db/mongo/async_mongo.py:2842-2853 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mongo/mongo.py:2608 — libs/agno/agno/db/mongo/mongo.py:2608-2619 | libs/agno/agno/db/mongo/mongo.py:2706-2717 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:548 — libs/agno/agno/db/mysql/async_mysql.py:548-559 | REDACTED:800-811 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:548` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1999 — libs/agno/agno/db/mysql/async_mysql.py:1999-2010 | libs/agno/agno/db/mysql/mysql.py:1971-1982 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2385 — libs/agno/agno/db/mysql/async_mysql.py:2385-2396 | libs/agno/agno/db/postgres/async_postgres.py:2730-2741 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:3099 — libs/agno/agno/db/mysql/async_mysql.py:3099-3110 | REDACTED:3639-3650 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) libs/agno/agno/db/mysql/mysql.py:3113 — libs/agno/agno/db/mysql/mysql.py:3113-3124 | libs/agno/agno/db/singlestore/singlestore.py:3059-3070 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:3113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 67 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×89
  • Duplicated block (10 lines × 2) cookbook/03_teams/05_knowledge/04_team_with_custom_retriever.py:62 — cookbook/03_teams/05_knowledge/04_team_with_custom_retriever.py:62-71 | cookbook/07_knowledge/09_archive/custom_retriever/retriever_with_dependencies.py:80-89 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) cookbook/03_teams/24_regenerate/01_regenerate.py:56 — cookbook/03_teams/24_regenerate/01_regenerate.py:56-66 | cookbook/03_teams/25_time_travel/01_continue_from.py:33-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/03_teams/24_regenerate/01_regenerate.py:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:175 — cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:175-184 | cookbook/data_labeling/_19_inter_annotator_agreement/jury_votes.py:211-220 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) cookbook/frameworks/claude-agent-sdk/continue_from/01_continue_finished_run.py:37 — cookbook/frameworks/claude-agent-sdk/continue_from/01_continue_finished_run.py:37-46 | cookbook/frameworks/claude-agent-sdk/continue_from/04_background_continue.py:48-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/frameworks/claude-agent-sdk/continue_from/01_continue_finished_run.py:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) cookbook/performance/comparison/long_conversation_comparison.py:111 — cookbook/performance/comparison/long_conversation_comparison.py:111-120 | cookbook/performance/comparison/multi_turn_comparison.py:131-140 — before extracting anything, compare `cookbook/performance/comparison/long_conversation_comparison.py` and `cookbook/performance/comparison/multi_turn_comparison.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) libs/agno/agno/agent/_response.py:810 — libs/agno/agno/agent/_response.py:810-819 | libs/agno/agno/team/_response.py:865-874 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) libs/agno/agno/agent/_storage.py:969 — libs/agno/agno/agent/_storage.py:969-978 | libs/agno/agno/team/_storage.py:642-651 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) libs/agno/agno/company/decisions.py:44 — libs/agno/agno/company/decisions.py:44-54 | libs/agno/agno/company/decisions.py:62-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/company/decisions.py:62` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) libs/agno/agno/context/calendar/provider.py:201 — libs/agno/agno/context/calendar/provider.py:201-210 | libs/agno/agno/context/gmail/provider.py:216-225 — `libs/agno/agno/context/calendar/provider.py` and `libs/agno/agno/context/gmail/provider.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 60 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/firestore/firestore.py:800 — libs/agno/agno/db/firestore/firestore.py:800-809 | libs/agno/agno/db/firestore/firestore.py:1331-1340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/firestore/firestore.py:1329` calls `where`, `FieldFilter` and `libs/agno/agno/db/firestore/firestore.py:799` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:212 — libs/agno/agno/db/gcs_json/gcs_json_db.py:212-221 | libs/agno/agno/db/json/json_db.py:237-246 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:313 — libs/agno/agno/db/gcs_json/gcs_json_db.py:313-322 | libs/agno/agno/db/json/json_db.py:349-358 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:409 — libs/agno/agno/db/gcs_json/gcs_json_db.py:409-418 | libs/agno/agno/db/json/json_db.py:456-465 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1424 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1424-1433 | libs/agno/agno/db/json/json_db.py:1521-1530 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) REDACTED:604 — REDACTED:604-613 | REDACTED:692-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) REDACTED:2267 — REDACTED:2267-2276 | REDACTED:2330-2339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:2264` calls `_get_table` and `REDACTED:2328` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) REDACTED:3840 — REDACTED:3840-3853 | REDACTED:3924-3933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3856` calls `quote_db_identifier`, `execute`, `text` and `REDACTED:3934` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) REDACTED:3863 — REDACTED:3863-3872 | REDACTED:3939-3948 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3875` calls `quote_db_identifier`, `execute`, `text` and `REDACTED:3949` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:543 — libs/agno/agno/db/mongo/async_mongo.py:543-552 | libs/agno/agno/db/mongo/mongo.py:342-351 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1541 — libs/agno/agno/db/mongo/async_mongo.py:1541-1550 | libs/agno/agno/db/mongo/mongo.py:1348-1357 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3140 — libs/agno/agno/db/mongo/async_mongo.py:3140-3149 | libs/agno/agno/db/mongo/mongo.py:3004-3013 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1270 — libs/agno/agno/db/postgres/async_postgres.py:1270-1279 | REDACTED:1226-1235 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1285` calls `_release_sandbox_leftovers` and `REDACTED:1242` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1839 — libs/agno/agno/db/postgres/async_postgres.py:1839-1848 | libs/agno/agno/db/postgres/postgres.py:2070-2079 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3555 — libs/agno/agno/db/postgres/async_postgres.py:3555-3564 | REDACTED:3705-3714 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3555` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3704` calls `log_debug` and `libs/agno/agno/db/postgres/async_postgres.py:3554` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3741 — libs/agno/agno/db/postgres/async_postgres.py:3741-3750 | libs/agno/agno/db/postgres/postgres.py:4282-4291 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 64 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×89
  • Duplicated block (9 lines × 2) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:129 — cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:129-137 | cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:126-134 — before extracting anything, compare `cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py` and `cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:128` calls `get` and `cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:125` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) REDACTED:81 — REDACTED:81-89 | REDACTED:117-125 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) cookbook/data_labeling/_05_text_pairwise_preference/dpo_jury.py:92 — cookbook/data_labeling/_05_text_pairwise_preference/dpo_jury.py:92-100 | cookbook/data_labeling/_05_text_pairwise_preference/jury_calibrated.py:153-161 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/agent/_session.py:247 — libs/agno/agno/agent/_session.py:247-255 | libs/agno/agno/agent/_session.py:276-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_session.py:244` calls `has_async_db`, `ValueError` and `libs/agno/agno/agent/_session.py:273` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) libs/agno/agno/agents/base.py:763 — libs/agno/agno/agents/base.py:763-771 | libs/agno/agno/agents/base.py:780-788 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) libs/agno/agno/compaction/compaction.py:943 — libs/agno/agno/compaction/compaction.py:943-951 | libs/agno/agno/compaction/compaction.py:1003-1011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/clickhouse/utils.py:267 — libs/agno/agno/db/clickhouse/utils.py:267-275 | libs/agno/agno/db/clickhouse/utils.py:277-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:1195 — libs/agno/agno/db/dynamo/dynamo.py:1195-1203 | libs/agno/agno/db/dynamo/dynamo.py:2271-2279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:3168 — libs/agno/agno/db/dynamo/dynamo.py:3168-3176 | libs/agno/agno/db/dynamo/dynamo.py:3187-3195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:3217 — libs/agno/agno/db/dynamo/dynamo.py:3217-3225 | libs/agno/agno/db/firestore/firestore.py:2755-2763 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) REDACTED:793 — REDACTED:793-801 | REDACTED:855-863 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) REDACTED:1548 — REDACTED:1548-1556 | REDACTED:1674-1682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) REDACTED:3069 — REDACTED:3069-3077 | REDACTED:3162-3170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `BaseDb` in one and `AsyncBaseDb` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) REDACTED:3905 — REDACTED:3905-3913 | REDACTED:3978-3986 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3987` calls `join`, `quote_db_identifier` and `REDACTED:3914` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1180 — libs/agno/agno/db/mysql/async_mysql.py:1180-1188 | libs/agno/agno/db/mysql/mysql.py:1173-1181 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/mysql/mysql.py:1296 — libs/agno/agno/db/mysql/mysql.py:1296-1304 | libs/agno/agno/db/singlestore/singlestore.py:1354-1363 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1897 — libs/agno/agno/db/postgres/async_postgres.py:1897-1905 | libs/agno/agno/db/postgres/postgres.py:2128-2136 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:1897` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3712 — libs/agno/agno/db/postgres/async_postgres.py:3712-3720 | libs/agno/agno/db/postgres/postgres.py:4253-4261 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3868 — libs/agno/agno/db/postgres/async_postgres.py:3868-3876 | libs/agno/agno/db/postgres/postgres.py:4407-4415 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4749 — libs/agno/agno/db/postgres/async_postgres.py:4749-4757 | REDACTED:4839-4847 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4929 — libs/agno/agno/db/postgres/async_postgres.py:4929-4937 | libs/agno/agno/db/postgres/postgres.py:7646-7654 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:4929` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5106 — libs/agno/agno/db/postgres/async_postgres.py:5106-5114 | libs/agno/agno/db/postgres/postgres.py:7810-7818 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5122 — libs/agno/agno/db/postgres/async_postgres.py:5122-5130 | libs/agno/agno/db/postgres/async_postgres.py:5150-5158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5594 — libs/agno/agno/db/postgres/async_postgres.py:5594-5602 | libs/agno/agno/db/postgres/postgres.py:8278-8286 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6496 — libs/agno/agno/db/postgres/async_postgres.py:6496-6504 | REDACTED:5665-5673 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • + 64 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×82
  • Duplicated block (15 lines × 2) cookbook/02_agents/11_approvals/approval_async.py:97 — cookbook/02_agents/11_approvals/approval_async.py:97-111 | cookbook/02_agents/11_approvals/audit_approval_async.py:83-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:169 — cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:169-183 | cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:180-194 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) cookbook/05_agent_os/08_os_config/config_basics.py:118 — cookbook/05_agent_os/08_os_config/config_basics.py:118-132 | cookbook/05_agent_os/08_os_config/yaml_config.py:80-94 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) cookbook/10_reasoning/models/ollama/local_reasoning.py:25 — cookbook/10_reasoning/models/ollama/local_reasoning.py:25-39 | cookbook/10_reasoning/models/ollama/local_reasoning.py:42-56 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) cookbook/frameworks/claude-agent-sdk/compaction.py:95 — cookbook/frameworks/claude-agent-sdk/compaction.py:95-109 | cookbook/frameworks/codex/codex_compaction.py:67-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) libs/agno/agno/agent/_init.py:105 — libs/agno/agno/agent/_init.py:105-119 | libs/agno/agno/team/_init.py:576-590 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) libs/agno/agno/agent/_managers.py:284 — libs/agno/agno/agent/_managers.py:284-298 | libs/agno/agno/agent/_managers.py:319-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_managers.py:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15 lines × 2) libs/agno/agno/agent/_response.py:416 — libs/agno/agno/agent/_response.py:416-430 | libs/agno/agno/team/_response.py:211-225 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) libs/agno/agno/agent/_run.py:4505 — libs/agno/agno/agent/_run.py:4505-4519 | libs/agno/agno/team/_run.py:8838-8852 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:4505` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) libs/agno/agno/agent/agent.py:766 — libs/agno/agno/agent/agent.py:766-780 | libs/agno/agno/team/team.py:721-735 — `libs/agno/agno/agent/agent.py` and `libs/agno/agno/team/team.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:888 — libs/agno/agno/db/dynamo/dynamo.py:888-902 | libs/agno/agno/db/dynamo/dynamo.py:1826-1840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1167 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1167-1181 | libs/agno/agno/db/json/json_db.py:1236-1250 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1440 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1440-1454 | libs/agno/agno/db/json/json_db.py:1538-1552 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) REDACTED:762 — REDACTED:762-776 | REDACTED:3076-3090 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1289 — libs/agno/agno/db/mongo/async_mongo.py:1289-1303 | libs/agno/agno/db/mongo/mongo.py:1098-1112 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1289` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2476 — libs/agno/agno/db/mongo/async_mongo.py:2476-2490 | libs/agno/agno/db/mongo/mongo.py:2282-2296 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:2476` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1736 — libs/agno/agno/db/mysql/async_mysql.py:1736-1750 | libs/agno/agno/db/mysql/mysql.py:1717-1731 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1778 — libs/agno/agno/db/mysql/async_mysql.py:1778-1792 | libs/agno/agno/db/postgres/async_postgres.py:2174-2188 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/mysql/mysql.py:463 — libs/agno/agno/db/mysql/mysql.py:463-477 | libs/agno/agno/db/singlestore/singlestore.py:554-568 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:463` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4146 — libs/agno/agno/db/postgres/async_postgres.py:4146-4160 | REDACTED:4281-4295 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4212 — libs/agno/agno/db/postgres/async_postgres.py:4212-4226 | REDACTED:4351-4365 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5376 — libs/agno/agno/db/postgres/async_postgres.py:5376-5390 | libs/agno/agno/db/postgres/postgres.py:8068-8082 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5376` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5758 — libs/agno/agno/db/postgres/async_postgres.py:5758-5772 | REDACTED:4925-4939 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6059 — libs/agno/agno/db/postgres/async_postgres.py:6059-6073 | REDACTED:5228-5242 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) libs/agno/agno/db/postgres/postgres.py:6483 — libs/agno/agno/db/postgres/postgres.py:6483-6497 | REDACTED:6267-6281 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • + 57 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×75
  • TodoComment libs/agno_infra/agno/utilities/git.py:29 — # TODO: Figure out multiple urls for origin and how to only get the fetch url — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/infra/operator.py:487 — # TODO: setup automatically for the user — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/docker/resource/network.py:63 — # TODO: validate that the network was actually created — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/docker/resource/volume.py:65 — # TODO: use json_to_dict(_attrs) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/docker/resource/volume.py:68 — # TODO: Validate that the volume object is created properly — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/cli/infra_cli.py:222 — # TODO: Use the -f flag logic to force build — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/aws/resource/glue/crawler.py:118 — # TODO: add more targets as needed — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno_infra/agno/aws/resource/ecs/task_definition.py:196 — # TODO: fix the task_definition_up_to_date function — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/tests/integration/models/perplexity/test_basic.py:141 — # TODO: citation tests are not working — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/tests/integration/db/surrealdb/test_surrealdb_evals.py:73 — # TODO: test filters — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/tests/integration/db/surrealdb/test_surrealdb_knowledge.py:63 — # TODO: test pagination and sorting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/tests/integration/db/surrealdb/test_surrealdb_session.py:49 — # TODO: add tests for get_sessions using filters and sorting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/workflow/remote.py:205 — # TODO: Deal with background — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/workflow/workflow.py:1532 — # TODO: Use db.load_component_graph instead of get_config — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/workflow/workflow.py:11233 — # TODO: This is a temporary method to convert the workflow to a dictionary for steps. We need to find a better way to do this. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/workflow/workflow.py:11437 — # TODO: Handle properly steps inside other primitives — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/vectordb/redis/redisdb.py:433 — # TODO: determine how we want to handle dtypes — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/vectordb/redis/redisdb.py:655 — # TODO: do we want to pass back the embedding? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:155 — # TODO(v2.0.0): Remove backward compatibility for unnamed vectors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:156 — # TODO(v2.0.0): Make named vectors mandatory and simplify the codebase — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:397 — # TODO(v2.0.0): Remove conditional vector naming logic — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:703 — # TODO(v2.0.0): Remove this conditional and always use named vectors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:752 — # TODO(v2.0.0): Remove this conditional and always use named vectors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/vectordb/lightrag/lightrag.py:381 — # TODO: Define supported extensions or implement proper URL validation — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment libs/agno/agno/utils/agent.py:356 — # TODO: Files aren't stored in session history yet and dont have a FileArtifact — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 50 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×74
  • Duplicated block (6 lines × 2) cookbook/02_agents/08_guardrails/openai_moderation.py:100 — cookbook/02_agents/08_guardrails/openai_moderation.py:100-105 | cookbook/03_teams/18_guardrails/openai_moderation.py:97-102 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/08_guardrails/openai_moderation.py:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) cookbook/05_agent_os/03_python_client/02_run_and_stream.py:61 — cookbook/05_agent_os/03_python_client/02_run_and_stream.py:61-66 | cookbook/05_agent_os/20_remote/01_remote_agent.py:57-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/03_python_client/02_run_and_stream.py:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:188 — cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:188-193 | cookbook/data_labeling/_19_inter_annotator_agreement/jury_votes.py:224-229 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/agent/_storage.py:1260 — libs/agno/agno/agent/_storage.py:1260-1265 | libs/agno/agno/team/_storage.py:1160-1165 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) libs/agno/agno/company/manager.py:883 — libs/agno/agno/company/manager.py:883-888 | libs/agno/agno/company/manager.py:1778-1783 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) libs/agno/agno/company/manager.py:904 — libs/agno/agno/company/manager.py:904-909 | libs/agno/agno/company/manager.py:1799-1804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/company/manager.py:904` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) libs/agno/agno/context/calendar/provider.py:171 — libs/agno/agno/context/calendar/provider.py:171-176 | libs/agno/agno/context/gmail/provider.py:186-191 — `libs/agno/agno/context/calendar/provider.py` and `libs/agno/agno/context/gmail/provider.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 60 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/context/web/parallel.py:110 — libs/agno/agno/context/web/parallel.py:110-115 | libs/agno/agno/context/web/parallel.py:124-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/context/web/parallel.py:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3156 — libs/agno/agno/db/mongo/async_mongo.py:3156-3161 | libs/agno/agno/db/mongo/async_mongo.py:3453-3458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:3094 — libs/agno/agno/db/mysql/async_mysql.py:3094-3099 | libs/agno/agno/db/mysql/async_mysql.py:3188-3193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1461 — libs/agno/agno/db/postgres/async_postgres.py:1461-1466 | libs/agno/agno/db/postgres/postgres.py:1631-1636 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1504 — libs/agno/agno/db/postgres/async_postgres.py:1504-1509 | REDACTED:1430-1435 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5723 — libs/agno/agno/db/postgres/async_postgres.py:5723-5729 | libs/agno/agno/db/postgres/postgres.py:8398-8403 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5723` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6381 — libs/agno/agno/db/postgres/async_postgres.py:6381-6386 | REDACTED:5550-5555 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6381` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/postgres.py:468 — libs/agno/agno/db/postgres/postgres.py:468-473 | REDACTED:483-488 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/postgres.py:1642 — libs/agno/agno/db/postgres/postgres.py:1642-1647 | REDACTED:1596-1601 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/postgres.py:1698 — libs/agno/agno/db/postgres/postgres.py:1698-1703 | REDACTED:1652-1657 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/postgres.py:1716 — libs/agno/agno/db/postgres/postgres.py:1716-1721 | REDACTED:1670-1675 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/postgres.py:9134 — libs/agno/agno/db/postgres/postgres.py:9134-9139 | REDACTED:8063-8068 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:9134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/postgres/postgres.py:9791 — libs/agno/agno/db/postgres/postgres.py:9791-9796 | REDACTED:8720-8725 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) REDACTED:1387 — REDACTED:1387-1392 | REDACTED:1585-1590 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) libs/agno/agno/db/valkey/valkey.py:1231 — libs/agno/agno/db/valkey/valkey.py:1231-1236 | libs/agno/agno/db/valkey/valkey.py:1682-1688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) libs/agno/agno/fs/fs.py:624 — libs/agno/agno/fs/fs.py:624-629 | libs/agno/agno/fs/fs.py:830-835 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) libs/agno/agno/fs/toolkit.py:481 — libs/agno/agno/fs/toolkit.py:481-486 | libs/agno/agno/fs/toolkit.py:870-875 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) libs/agno/agno/knowledge/embedder/azure_openai.py:131 — libs/agno/agno/knowledge/embedder/azure_openai.py:131-136 | libs/agno/agno/knowledge/embedder/azure_openai.py:168-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 49 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED · ×70
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 45 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×70
  • Duplicated block (16 lines × 2) cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:155 — cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:155-170 | cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:235-250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_cli.py:251 — libs/agno/agno/agent/_cli.py:251-266 | libs/agno/agno/team/_cli.py:274-289 — `libs/agno/agno/agent/_cli.py` and `libs/agno/agno/team/_cli.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_messages.py:374 — libs/agno/agno/agent/_messages.py:374-389 | libs/agno/agno/agent/_messages.py:411-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_messages.py:705 — libs/agno/agno/agent/_messages.py:705-720 | libs/agno/agno/agent/_messages.py:778-793 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_response.py:1042 — libs/agno/agno/agent/_response.py:1042-1057 | libs/agno/agno/agent/_response.py:1206-1221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_run.py:162 — libs/agno/agno/agent/_run.py:162-177 | libs/agno/agno/agent/_run.py:207-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_run.py:1783 — libs/agno/agno/agent/_run.py:1783-1798 | libs/agno/agno/agent/_run.py:5018-5033 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5015` calls `araise_if_cancelled` and `libs/agno/agno/agent/_run.py:1780` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_run.py:6593 — libs/agno/agno/agent/_run.py:6593-6609 | libs/agno/agno/team/_run.py:7357-7372 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) libs/agno/agno/agent/_storage.py:856 — libs/agno/agno/agent/_storage.py:856-871 | libs/agno/agno/team/_storage.py:564-579 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) libs/agno/agno/agents/codex/agent.py:697 — libs/agno/agno/agents/codex/agent.py:697-712 | libs/agno/agno/agents/codex/agent.py:723-738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1575 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1575-1590 | libs/agno/agno/db/json/json_db.py:1679-1694 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1958 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1958-1973 | libs/agno/agno/db/json/json_db.py:2053-2068 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) REDACTED:2089 — REDACTED:2089-2104 | REDACTED:2155-2170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/mongo/utils.py:295 — libs/agno/agno/db/mongo/utils.py:295-310 | libs/agno/agno/db/mongo/utils.py:342-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/utils.py:295` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/mysql/mysql.py:3193 — libs/agno/agno/db/mysql/mysql.py:3193-3208 | libs/agno/agno/db/singlestore/singlestore.py:3145-3160 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:834 — libs/agno/agno/db/postgres/async_postgres.py:834-849 | libs/agno/agno/db/postgres/postgres.py:991-1006 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:834` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1717 — libs/agno/agno/db/postgres/async_postgres.py:1717-1732 | libs/agno/agno/db/postgres/postgres.py:1948-1963 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:1717` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6456 — libs/agno/agno/db/postgres/async_postgres.py:6456-6471 | REDACTED:5625-5640 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6893 — libs/agno/agno/db/postgres/async_postgres.py:6893-6908 | REDACTED:6062-6077 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/postgres.py:6749 — libs/agno/agno/db/postgres/postgres.py:6749-6764 | REDACTED:6520-6535 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/postgres.py:8528 — libs/agno/agno/db/postgres/postgres.py:8528-8543 | REDACTED:7460-7475 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/postgres.py:8749 — libs/agno/agno/db/postgres/postgres.py:8749-8764 | REDACTED:7681-7696 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/postgres.py:9209 — libs/agno/agno/db/postgres/postgres.py:9209-9224 | REDACTED:8138-8153 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/postgres.py:9390 — libs/agno/agno/db/postgres/postgres.py:9390-9405 | REDACTED:8319-8334 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) libs/agno/agno/db/postgres/postgres.py:9628 — libs/agno/agno/db/postgres/postgres.py:9628-9643 | REDACTED:8557-8572 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 45 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×69
  • TooManyMethods: PostgresDb libs/agno/agno/db/postgres/postgres.py:135 — TooManyMethods — 256 methods. The bar is 30 methods; this is 226 over it, 8.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SqliteDb REDACTED:101 — TooManyMethods — 229 methods. The bar is 30 methods; this is 199 over it, 7.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BaseDb libs/agno/agno/db/base.py:299 — TooManyMethods — 212 methods. The bar is 30 methods; this is 182 over it, 7.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AsyncPostgresDb libs/agno/agno/db/postgres/async_postgres.py:107 — TooManyMethods — 209 methods. The bar is 30 methods; this is 179 over it, 6.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AsyncBaseDb libs/agno/agno/db/base.py:2641 — TooManyMethods — 190 methods. The bar is 30 methods; this is 160 over it, 6.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AsyncSqliteDb REDACTED:75 — TooManyMethods — 185 methods. The bar is 30 methods; this is 155 over it, 6.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StudioTools libs/agno/agno/tools/studio.py:207 — TooManyMethods — 130 methods. The bar is 30 methods; this is 100 over it, 4.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Elasticsearch REDACTED:45 — TooManyMethods — 104 methods. The bar is 30 methods; this is 74 over it, 3.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StudioRunnerTools libs/agno/agno/tools/studio_runner.py:288 — TooManyMethods — 97 methods. The bar is 30 methods; this is 67 over it, 3.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RedisDb libs/agno/agno/db/redis/redis.py:54 — TooManyMethods — 95 methods. The bar is 30 methods; this is 65 over it, 3.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: OpenSearch REDACTED:36 — TooManyMethods — 89 methods. The bar is 30 methods; this is 59 over it, 2.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AsyncMongoDb libs/agno/agno/db/mongo/async_mongo.py:151 — TooManyMethods — 87 methods. The bar is 30 methods; this is 57 over it, 2.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MongoDb libs/agno/agno/db/mongo/mongo.py:61 — TooManyMethods — 85 methods. The bar is 30 methods; this is 55 over it, 2.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BaseExternalAgent libs/agno/agno/agents/base.py:208 — TooManyMethods — 82 methods. The bar is 30 methods; this is 52 over it, 2.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AgentOSClient libs/agno/agno/client/os.py:77 — TooManyMethods — 80 methods. The bar is 30 methods; this is 50 over it, 2.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RoleStore libs/agno/agno/os/authz/_role_store.py:156 — TooManyMethods — 77 methods. The bar is 30 methods; this is 47 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ValkeyDb libs/agno/agno/db/valkey/valkey.py:67 — TooManyMethods — 76 methods. The bar is 30 methods; this is 46 over it, 2.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Authorization libs/agno/agno/os/authz/authorization.py:84 — TooManyMethods — 68 methods. The bar is 30 methods; this is 38 over it, 2.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DynamoDb libs/agno/agno/db/dynamo/dynamo.py:64 — TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: JsonDb libs/agno/agno/db/json/json_db.py:46 — TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AsyncMySQLDb libs/agno/agno/db/mysql/async_mysql.py:59 — TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MySQLDb libs/agno/agno/db/mysql/mysql.py:60 — TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NativePolicyEngine libs/agno/agno/os/authz/native_engine.py:86 — TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: GcsJsonDb libs/agno/agno/db/gcs_json/gcs_json_db.py:44 — TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SingleStoreDb libs/agno/agno/db/singlestore/singlestore.py:59 — TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 44 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×69
  • Duplicated block (17 lines × 2) cookbook/08_learning/08_custom_stores/02_custom_store_with_db.py:99 — cookbook/08_learning/08_custom_stores/02_custom_store_with_db.py:99-115 | cookbook/08_learning/08_custom_stores/02_custom_store_with_db.py:128-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/08_learning/08_custom_stores/02_custom_store_with_db.py:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) cookbook/12_context/18_gmail.py:64 — cookbook/12_context/18_gmail.py:64-80 | cookbook/12_context/19_calendar.py:64-80 — before extracting anything, compare `cookbook/12_context/18_gmail.py` and `cookbook/12_context/19_calendar.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/12_context/18_gmail.py:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:145 — cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:145-161 | cookbook/data_labeling/_19_inter_annotator_agreement/jury_votes.py:180-196 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) cookbook/frameworks/claude-agent-sdk/claude_media.py:33 — cookbook/frameworks/claude-agent-sdk/claude_media.py:33-49 | cookbook/frameworks/codex/codex_media.py:32-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_default_tools.py:494 — libs/agno/agno/agent/_default_tools.py:494-510 | libs/agno/agno/agent/_default_tools.py:549-565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_hooks.py:430 — libs/agno/agno/agent/_hooks.py:430-446 | libs/agno/agno/team/_hooks.py:603-619 — `libs/agno/agno/agent/_hooks.py` and `libs/agno/agno/team/_hooks.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 106 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_hooks.py:430` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_messages.py:391 — libs/agno/agno/agent/_messages.py:391-407 | libs/agno/agno/agent/_messages.py:428-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:391` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_run.py:1047 — libs/agno/agno/agent/_run.py:1047-1063 | libs/agno/agno/agent/_run.py:3966-3982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1047` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_run.py:2639 — libs/agno/agno/agent/_run.py:2639-2655 | libs/agno/agno/team/_run.py:4072-4088 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2639` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_session.py:51 — libs/agno/agno/agent/_session.py:51-67 | libs/agno/agno/team/_init.py:770-786 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17 lines × 2) libs/agno/agno/agent/_tools.py:241 — libs/agno/agno/agent/_tools.py:241-257 | libs/agno/agno/agent/_tools.py:388-404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:241` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1596 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1596-1612 | libs/agno/agno/db/json/json_db.py:1700-1716 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/in_memory/in_memory_db.py:292 — libs/agno/agno/db/in_memory/in_memory_db.py:292-308 | libs/agno/agno/db/in_memory/in_memory_db.py:773-789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:951 — libs/agno/agno/db/mongo/async_mongo.py:951-967 | libs/agno/agno/db/mongo/mongo.py:761-777 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1873 — libs/agno/agno/db/mongo/async_mongo.py:1873-1889 | libs/agno/agno/db/mongo/mongo.py:1678-1694 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3093 — libs/agno/agno/db/mongo/async_mongo.py:3093-3109 | libs/agno/agno/db/mongo/async_mongo.py:3398-3414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3337 — libs/agno/agno/db/mongo/async_mongo.py:3337-3353 | libs/agno/agno/db/mongo/mongo.py:3211-3227 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1629 — libs/agno/agno/db/mysql/async_mysql.py:1629-1645 | libs/agno/agno/db/mysql/mysql.py:1610-1626 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1921 — libs/agno/agno/db/mysql/async_mysql.py:1921-1937 | libs/agno/agno/db/postgres/async_postgres.py:2327-2343 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1222 — libs/agno/agno/db/postgres/async_postgres.py:1222-1238 | REDACTED:1180-1196 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4016 — libs/agno/agno/db/postgres/async_postgres.py:4016-4032 | REDACTED:4151-4167 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4127 — libs/agno/agno/db/postgres/async_postgres.py:4127-4143 | REDACTED:4262-4278 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4347 — libs/agno/agno/db/postgres/async_postgres.py:4347-4363 | REDACTED:4419-4435 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5574 — libs/agno/agno/db/postgres/async_postgres.py:5574-5590 | libs/agno/agno/db/postgres/postgres.py:8258-8274 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5983 — libs/agno/agno/db/postgres/async_postgres.py:5983-5999 | REDACTED:5150-5166 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 44 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×68
  • Duplicated block (18 lines × 2) cookbook/02_agents/11_approvals/approval_async.py:26 — cookbook/02_agents/11_approvals/approval_async.py:26-43 | cookbook/02_agents/11_approvals/approval_basic.py:25-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (18 lines × 2) cookbook/04_workflows/06_advanced_concepts/history/history_in_function.py:213 — cookbook/04_workflows/06_advanced_concepts/history/history_in_function.py:213-230 | cookbook/04_workflows/06_advanced_concepts/history/intent_routing_with_history.py:158-175 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/06_advanced_concepts/history/history_in_function.py:213` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:114 — cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:114-131 | cookbook/10_reasoning/tools/capture_reasoning_content_reasoning_tools.py:71-88 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:110` calls `hasattr` and `cookbook/10_reasoning/tools/capture_reasoning_content_reasoning_tools.py:69` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) cookbook/91_tools/mcp/sse_transport/client.py:42 — cookbook/91_tools/mcp/sse_transport/client.py:42-59 | cookbook/91_tools/mcp/streamable_http_transport/client.py:41-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) cookbook/91_tools/tool_decorator/async_tool_decorator.py:23 — cookbook/91_tools/tool_decorator/async_tool_decorator.py:23-40 | cookbook/91_tools/tool_hooks/pre_and_post_hooks.py:76-93 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) cookbook/data_labeling/_26_scale_out/basic.py:96 — cookbook/data_labeling/_26_scale_out/basic.py:96-113 | cookbook/data_labeling/_26_scale_out/with_cost_tracking.py:106-123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_hooks.py:114 — libs/agno/agno/agent/_hooks.py:114-131 | libs/agno/agno/agent/_hooks.py:328-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_hooks.py:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_response.py:195 — libs/agno/agno/agent/_response.py:195-212 | libs/agno/agno/team/_response.py:609-626 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `TeamRunOutput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_run.py:1126 — libs/agno/agno/agent/_run.py:1126-1143 | libs/agno/agno/agent/_run.py:2480-2497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_run.py:1198 — libs/agno/agno/agent/_run.py:1198-1215 | libs/agno/agno/agent/_run.py:1252-1269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_run.py:1409 — libs/agno/agno/agent/_run.py:1409-1426 | libs/agno/agno/agent/_run.py:2801-2818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1409` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_storage.py:1315 — libs/agno/agno/agent/_storage.py:1315-1332 | libs/agno/agno/team/_storage.py:1221-1238 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) libs/agno/agno/agent/_utils.py:161 — libs/agno/agno/agent/_utils.py:161-178 | libs/agno/agno/team/_utils.py:143-160 — `libs/agno/agno/agent/_utils.py` and `libs/agno/agno/team/_utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 107 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) REDACTED:3080 — REDACTED:3080-3097 | REDACTED:3350-3367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3346` calls `execute`, `text`, `scalar` and `REDACTED:3079` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) REDACTED:3344 — REDACTED:3344-3361 | REDACTED:4159-4176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (18 lines × 2) REDACTED:3421 — REDACTED:3421-3438 | REDACTED:4226-4243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2396 — libs/agno/agno/db/mongo/async_mongo.py:2396-2413 | libs/agno/agno/db/mongo/mongo.py:2202-2219 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2859 — libs/agno/agno/db/postgres/async_postgres.py:2859-2876 | libs/agno/agno/db/postgres/postgres.py:3401-3418 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4446 — libs/agno/agno/db/postgres/async_postgres.py:4446-4463 | REDACTED:4519-4536 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6356 — libs/agno/agno/db/postgres/async_postgres.py:6356-6373 | REDACTED:5525-5542 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/postgres/postgres.py:3181 — libs/agno/agno/db/postgres/postgres.py:3181-3198 | libs/agno/agno/db/singlestore/singlestore.py:2300-2317 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/postgres/postgres.py:6305 — libs/agno/agno/db/postgres/postgres.py:6305-6322 | REDACTED:6089-6106 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:6305` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/db/postgres/postgres.py:9109 — libs/agno/agno/db/postgres/postgres.py:9109-9126 | REDACTED:8038-8055 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/eval/accuracy.py:307 — libs/agno/agno/eval/accuracy.py:307-324 | libs/agno/agno/eval/accuracy.py:340-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) libs/agno/agno/knowledge/embedder/mistral.py:101 — libs/agno/agno/knowledge/embedder/mistral.py:101-118 | libs/agno/agno/knowledge/embedder/mistral.py:131-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 43 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×65
  • Duplicated block (7 lines × 2) cookbook/02_agents/03_context_management/compaction/compaction_async_token_counter.py:47 — cookbook/02_agents/03_context_management/compaction/compaction_async_token_counter.py:47-53 | cookbook/02_agents/03_context_management/compaction/compaction_threshold_room.py:29-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) cookbook/05_agent_os/14_mcp/inspect_tools.py:149 — cookbook/05_agent_os/14_mcp/inspect_tools.py:149-155 | cookbook/05_agent_os/14_mcp/inspect_tools.py:170-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/14_mcp/inspect_tools.py:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:127 — cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:127-133 | cookbook/data_labeling/_19_inter_annotator_agreement/jury_votes.py:160-166 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) cookbook/performance/comparison/import_time_comparison.py:33 — cookbook/performance/comparison/import_time_comparison.py:33-39 | cookbook/performance/import_time.py:90-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) libs/agno/agno/agent/_response.py:988 — libs/agno/agno/agent/_response.py:988-994 | libs/agno/agno/team/_response.py:946-952 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) libs/agno/agno/company/manager.py:449 — libs/agno/agno/company/manager.py:449-455 | libs/agno/agno/company/manager.py:1342-1348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/dynamo/utils.py:74 — libs/agno/agno/db/dynamo/utils.py:74-80 | REDACTED:2403-2409 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/migrations/manager.py:127 — libs/agno/agno/db/migrations/manager.py:127-133 | libs/agno/agno/db/migrations/manager.py:226-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) REDACTED:624 — REDACTED:624-630 | REDACTED:638-644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:624` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:594 — libs/agno/agno/db/mongo/async_mongo.py:594-600 | libs/agno/agno/db/mongo/mongo.py:395-401 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:775 — libs/agno/agno/db/mongo/async_mongo.py:775-781 | libs/agno/agno/db/mongo/async_mongo.py:1052-1058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mongo/async_mongo.py:773` calls `sort` and `libs/agno/agno/db/mongo/async_mongo.py:1049` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:267 — libs/agno/agno/db/mysql/async_mysql.py:267-273 | REDACTED:440-449 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1472 — libs/agno/agno/db/postgres/async_postgres.py:1472-1478 | REDACTED:1398-1404 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6020 — libs/agno/agno/db/postgres/async_postgres.py:6020-6026 | REDACTED:5187-5193 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6027 — libs/agno/agno/db/postgres/async_postgres.py:6027-6033 | REDACTED:5194-5200 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6424 — libs/agno/agno/db/postgres/async_postgres.py:6424-6430 | REDACTED:5593-5599 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6534 — libs/agno/agno/db/postgres/async_postgres.py:6534-6540 | REDACTED:5703-5709 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6608 — libs/agno/agno/db/postgres/async_postgres.py:6608-6614 | REDACTED:5777-5783 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6743 — libs/agno/agno/db/postgres/async_postgres.py:6743-6749 | REDACTED:5912-5918 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/postgres.py:1706 — libs/agno/agno/db/postgres/postgres.py:1706-1712 | REDACTED:1660-1666 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/postgres.py:7086 — libs/agno/agno/db/postgres/postgres.py:7086-7092 | REDACTED:6854-6860 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/postgres/postgres.py:8782 — libs/agno/agno/db/postgres/postgres.py:8782-8788 | REDACTED:7714-7720 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) libs/agno/agno/db/singlestore/singlestore.py:196 — libs/agno/agno/db/singlestore/singlestore.py:196-202 | libs/agno/agno/db/singlestore/singlestore.py:283-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) libs/agno/agno/fs/fs.py:533 — libs/agno/agno/fs/fs.py:533-539 | libs/agno/agno/fs/fs.py:737-743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) libs/agno/agno/fs/fs.py:573 — libs/agno/agno/fs/fs.py:573-579 | libs/agno/agno/fs/fs.py:779-785 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 40 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×62
  • Duplicated block (5 lines × 2) cookbook/05_agent_os/12_scheduler/02_rest_api.py:147 — cookbook/05_agent_os/12_scheduler/02_rest_api.py:147-151 | cookbook/05_agent_os/12_scheduler/04_scheduler_tools_agent.py:173-177 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) cookbook/07_knowledge/09_archive/embedders/vllm_embedder_local.py:54 — cookbook/07_knowledge/09_archive/embedders/vllm_embedder_local.py:54-58 | cookbook/07_knowledge/09_archive/embedders/vllm_embedder_remote.py:51-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) libs/agno/agno/cloud/aws/s3/bucket.py:189 — libs/agno/agno/cloud/aws/s3/bucket.py:189-193 | libs/agno_infra/agno/aws/resource/s3/bucket.py:190-194 — before extracting anything, compare `libs/agno/agno/cloud/aws/s3/bucket.py` and `libs/agno_infra/agno/aws/resource/s3/bucket.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `AwsApiClient` names `agno.aws.api_client` in one and `agno.cloud.aws.s3.api_client` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) libs/agno/agno/company/automation_history.py:98 — libs/agno/agno/company/automation_history.py:98-102 | libs/agno/agno/company/automation_history.py:123-127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) libs/agno/agno/context/wiki/provider.py:182 — libs/agno/agno/context/wiki/provider.py:182-186 | libs/agno/agno/context/wiki/provider.py:266-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/firestore/firestore.py:1326 — libs/agno/agno/db/firestore/firestore.py:1326-1330 | libs/agno/agno/db/firestore/firestore.py:2085-2089 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) REDACTED:3636 — REDACTED:3636-3641 | REDACTED:4397-4401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) REDACTED:4331 — REDACTED:4331-4335 | REDACTED:4392-4396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `BaseDb` in one and `AsyncBaseDb` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:655 — libs/agno/agno/db/mongo/async_mongo.py:655-659 | libs/agno/agno/db/mongo/mongo.py:455-459 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `runs_collection` to `AsyncMongoCollectionType` in one and `Collection` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1923 — libs/agno/agno/db/mongo/async_mongo.py:1923-1927 | libs/agno/agno/db/mongo/mongo.py:1730-1734 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2142 — libs/agno/agno/db/postgres/async_postgres.py:2142-2146 | libs/agno/agno/db/postgres/postgres.py:2599-2603 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6376 — libs/agno/agno/db/postgres/async_postgres.py:6376-6380 | REDACTED:5545-5549 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6376` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/postgres/postgres.py:1672 — libs/agno/agno/db/postgres/postgres.py:1672-1676 | REDACTED:1626-1630 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/postgres/postgres.py:8790 — libs/agno/agno/db/postgres/postgres.py:8790-8794 | REDACTED:7722-7726 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/postgres/postgres.py:9129 — libs/agno/agno/db/postgres/postgres.py:9129-9133 | REDACTED:8058-8062 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:9129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/sql/authz.py:81 — libs/agno/agno/db/sql/authz.py:81-85 | libs/agno/agno/db/sql/authz.py:592-596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/sql/authz.py:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/sql/authz.py:508 — libs/agno/agno/db/sql/authz.py:508-512 | libs/agno/agno/db/sql/authz.py:870-874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) libs/agno/agno/db/sql/authz.py:523 — libs/agno/agno/db/sql/authz.py:523-527 | libs/agno/agno/db/sql/authz.py:886-890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) REDACTED:2264 — REDACTED:2264-2268 | REDACTED:2521-2525 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) libs/agno/agno/integrations/discord/client.py:189 — libs/agno/agno/integrations/discord/client.py:189-194 | libs/agno/agno/os/interfaces/whatsapp/helpers.py:351-355 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) libs/agno/agno/knowledge/embedder/google.py:240 — libs/agno/agno/knowledge/embedder/google.py:240-244 | libs/agno/agno/knowledge/embedder/mistral.py:203-207 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/embedder/google.py:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) libs/agno/agno/knowledge/loaders/sharepoint.py:86 — libs/agno/agno/knowledge/loaders/sharepoint.py:86-90 | libs/agno/agno/knowledge/loaders/sharepoint.py:106-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) libs/agno/agno/knowledge/reader/page_fetcher.py:175 — libs/agno/agno/knowledge/reader/page_fetcher.py:175-179 | libs/agno/agno/knowledge/reader/page_fetcher.py:201-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) libs/agno/agno/learn/schemas.py:861 — libs/agno/agno/learn/schemas.py:861-865 | libs/agno/agno/learn/schemas.py:883-887 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) libs/agno/agno/learn/schemas.py:880 — libs/agno/agno/learn/schemas.py:880-884 | libs/agno/agno/learn/stores/entity_memory.py:2035-2039 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • + 37 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×57
  • Duplicated block (19 lines × 2) cookbook/04_workflows/08_human_in_the_loop/error/01_error_retry_skip.py:89 — cookbook/04_workflows/08_human_in_the_loop/error/01_error_retry_skip.py:89-107 | cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:92-110 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (19 lines × 2) cookbook/05_agent_os/08_os_config/config_basics.py:100 — cookbook/05_agent_os/08_os_config/config_basics.py:100-118 | cookbook/05_agent_os/08_os_config/yaml_config.py:60-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/05_agent_os/08_os_config/yaml_config.py:80` calls `RuntimeError` and `cookbook/05_agent_os/08_os_config/config_basics.py:120` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_run.py:487 — libs/agno/agno/agent/_run.py:487-505 | libs/agno/agno/agent/_run.py:896-914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:487` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_run.py:1360 — libs/agno/agno/agent/_run.py:1360-1378 | libs/agno/agno/agent/_run.py:2743-2761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_run.py:1855 — libs/agno/agno/agent/_run.py:1855-1873 | libs/agno/agno/agent/_run.py:5085-5103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_run.py:2347 — libs/agno/agno/agent/_run.py:2347-2365 | libs/agno/agno/agent/_run.py:5491-5509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2347` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_run.py:6443 — libs/agno/agno/agent/_run.py:6443-6465 | libs/agno/agno/team/_run.py:7190-7208 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `source_session` to `AgentSession` in one and `TeamSession` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_storage.py:911 — libs/agno/agno/agent/_storage.py:911-929 | libs/agno/agno/team/_storage.py:741-759 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) libs/agno/agno/agent/_tools.py:85 — libs/agno/agno/agent/_tools.py:85-103 | libs/agno/agno/agent/_tools.py:111-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) REDACTED:23 — REDACTED:23-41 | REDACTED:19-37 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) REDACTED:81 — REDACTED:81-99 | REDACTED:75-93 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) REDACTED:4057 — REDACTED:4057-4075 | REDACTED:4165-4183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3741 — libs/agno/agno/db/mongo/async_mongo.py:3741-3759 | libs/agno/agno/db/mongo/mongo.py:3541-3559 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1345 — libs/agno/agno/db/mysql/async_mysql.py:1345-1363 | REDACTED:1831-1849 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1328 — libs/agno/agno/db/postgres/async_postgres.py:1328-1346 | REDACTED:1282-1300 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5487 — libs/agno/agno/db/postgres/async_postgres.py:5487-5505 | libs/agno/agno/db/postgres/postgres.py:8176-8194 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5487` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5676 — libs/agno/agno/db/postgres/async_postgres.py:5676-5694 | libs/agno/agno/db/postgres/postgres.py:8354-8372 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/postgres/postgres.py:1726 — libs/agno/agno/db/postgres/postgres.py:1726-1744 | REDACTED:1680-1698 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/redis/redis.py:1181 — libs/agno/agno/db/redis/redis.py:1181-1199 | libs/agno/agno/db/valkey/valkey.py:1475-1493 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:1181` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/db/redis/redis.py:1741 — libs/agno/agno/db/redis/redis.py:1741-1759 | libs/agno/agno/db/valkey/valkey.py:2127-2145 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (19 lines × 2) REDACTED:1646 — REDACTED:1646-1664 | REDACTED:1902-1920 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1646` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/eval/accuracy.py:722 — libs/agno/agno/eval/accuracy.py:722-740 | libs/agno/agno/eval/accuracy.py:834-852 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) libs/agno/agno/knowledge/loaders/gcs.py:140 — libs/agno/agno/knowledge/loaders/gcs.py:140-158 | libs/agno/agno/knowledge/loaders/s3.py:124-142 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/knowledge/loaders/gcs.py:227 — libs/agno/agno/knowledge/loaders/gcs.py:227-245 | libs/agno/agno/knowledge/loaders/s3.py:220-238 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) libs/agno/agno/knowledge/reader/markdown_reader.py:97 — libs/agno/agno/knowledge/reader/markdown_reader.py:97-115 | libs/agno/agno/knowledge/reader/text_reader.py:75-93 — before extracting anything, compare `libs/agno/agno/knowledge/reader/markdown_reader.py` and `libs/agno/agno/knowledge/reader/text_reader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • + 32 more in this group — see findings.md.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×40
  • Outbound HTTP without resilience cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:34 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:40 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/10_human_in_the_loop/confirmation_required.py:34 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/10_human_in_the_loop/confirmation_required.py:40 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/11_approvals/approval_async.py:34 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/11_approvals/approval_async.py:38 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/11_approvals/approval_basic.py:33 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/11_approvals/approval_basic.py:37 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/12_multimodal/audio_input_output.py:17 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/12_multimodal/audio_sentiment_analysis.py:29 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/12_multimodal/audio_to_text.py:23 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/15_dependencies/dependencies_in_context.py:27 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/02_agents/15_dependencies/dependencies_in_context.py:34 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/03_teams/19_multimodal/audio_sentiment_analysis.py:64 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/03_teams/19_multimodal/audio_to_text.py:58 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/05_agent_os/13_observability/filtering.py:93 — `httpx.AsyncClient(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/05_agent_os/13_observability/metrics.py:63 — `httpx.AsyncClient(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/05_agent_os/13_observability/read_traces.py:81 — `httpx.AsyncClient(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/05_agent_os/13_observability/traces_to_clickhouse.py:99 — `httpx.AsyncClient(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/06_storage/05_media_storage_local.py:61 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/06_storage/06_media_storage_s3.py:86 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/06_storage/07_media_storage_multiturn.py:62 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/06_storage/08_media_storage_gcs.py:84 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/06_storage/09_media_storage_delete.py:73 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience cookbook/06_storage/10_media_storage_workflow.py:86 — `httpx.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×38
  • Duplicated block (20 lines × 2) libs/agno/agno/agent/_run.py:683 — libs/agno/agno/agent/_run.py:683-702 | libs/agno/agno/agent/_run.py:1844-1863 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:683` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/agent/_run.py:2746 — libs/agno/agno/agent/_run.py:2746-2765 | libs/agno/agno/team/_run.py:4188-4207 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20 lines × 2) libs/agno/agno/agent/remote.py:288 — libs/agno/agno/agent/remote.py:288-307 | libs/agno/agno/team/remote.py:281-300 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2888 — libs/agno/agno/db/mysql/async_mysql.py:2888-2907 | REDACTED:3414-3433 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/mysql/mysql.py:2274 — libs/agno/agno/db/mysql/mysql.py:2274-2293 | REDACTED:3103-3122 — `libs/agno/agno/db/mysql/mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 102 separate duplicated blocks between them, totalling at least 1766 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/mysql/mysql.py:3211 — libs/agno/agno/db/mysql/mysql.py:3211-3230 | libs/agno/agno/db/singlestore/singlestore.py:3163-3182 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1769 — libs/agno/agno/db/postgres/async_postgres.py:1769-1788 | libs/agno/agno/db/postgres/postgres.py:2000-2019 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/postgres/postgres.py:7274 — libs/agno/agno/db/postgres/postgres.py:7274-7293 | REDACTED:7042-7061 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/postgres/postgres.py:8699 — libs/agno/agno/db/postgres/postgres.py:8699-8718 | REDACTED:7631-7650 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/redis/redis.py:550 — libs/agno/agno/db/redis/redis.py:550-569 | libs/agno/agno/db/valkey/valkey.py:636-655 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/redis/redis.py:1072 — libs/agno/agno/db/redis/redis.py:1072-1091 | libs/agno/agno/db/valkey/valkey.py:1366-1385 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/redis/redis.py:1441 — libs/agno/agno/db/redis/redis.py:1441-1460 | libs/agno/agno/db/valkey/valkey.py:1814-1833 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:1441` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/db/redis/redis.py:1580 — libs/agno/agno/db/redis/redis.py:1580-1599 | libs/agno/agno/db/valkey/valkey.py:1966-1985 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) REDACTED:1521 — REDACTED:1521-1540 | REDACTED:1778-1797 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/eval/accuracy.py:407 — libs/agno/agno/eval/accuracy.py:407-426 | libs/agno/agno/eval/accuracy.py:549-568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/eval/accuracy.py:407` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/knowledge/embedder/azure_openai.py:52 — libs/agno/agno/knowledge/embedder/azure_openai.py:52-71 | libs/agno/agno/knowledge/embedder/azure_openai.py:80-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) libs/agno/agno/knowledge/knowledge.py:4937 — libs/agno/agno/knowledge/knowledge.py:4937-4956 | libs/agno/agno/knowledge/knowledge.py:5110-5129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/media/storage/s3/async_s3.py:119 — libs/agno/agno/media/storage/s3/async_s3.py:119-138 | libs/agno/agno/media/storage/s3/s3.py:119-138 — before extracting anything, compare `libs/agno/agno/media/storage/s3/async_s3.py` and `libs/agno/agno/media/storage/s3/s3.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/models/moonshot/moonshot.py:82 — libs/agno/agno/models/moonshot/moonshot.py:82-101 | libs/agno/agno/models/xiaomi/mimo.py:66-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (20 lines × 2) libs/agno/agno/models/openai/responses.py:1116 — libs/agno/agno/models/openai/responses.py:1116-1135 | libs/agno/agno/models/openai/responses.py:1225-1244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) libs/agno/agno/reasoning/anthropic.py:111 — libs/agno/agno/reasoning/anthropic.py:111-130 | libs/agno/agno/reasoning/vertexai.py:102-121 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/vertexai.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) libs/agno/agno/reasoning/anthropic.py:190 — libs/agno/agno/reasoning/anthropic.py:190-209 | libs/agno/agno/reasoning/vertexai.py:144-163 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/vertexai.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) libs/agno/agno/session/team.py:377 — libs/agno/agno/session/team.py:377-396 | libs/agno/agno/session/workflow.py:209-228 — before extracting anything, compare `libs/agno/agno/session/team.py` and `libs/agno/agno/session/workflow.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/team/_response.py:418 — libs/agno/agno/team/_response.py:418-437 | libs/agno/agno/team/_response.py:503-522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) libs/agno/agno/team/_task_tools.py:483 — libs/agno/agno/team/_task_tools.py:483-502 | libs/agno/agno/team/_task_tools.py:666-685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 13 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×37
  • Duplicated block (21 lines × 2) cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_additional_data.py:94 — cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_additional_data.py:94-114 | cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_additional_data.py:167-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) libs/agno/agno/agent/_default_tools.py:398 — libs/agno/agno/agent/_default_tools.py:398-418 | libs/agno/agno/team/_default_tools.py:1565-1585 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (21 lines × 2) libs/agno/agno/agent/_response.py:145 — libs/agno/agno/agent/_response.py:145-165 | libs/agno/agno/team/_response.py:559-579 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `TeamRunOutput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (21 lines × 2) libs/agno/agno/agent/_response.py:452 — libs/agno/agno/agent/_response.py:452-472 | libs/agno/agno/agent/_response.py:520-540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) libs/agno/agno/agent/_response.py:615 — libs/agno/agno/agent/_response.py:615-635 | libs/agno/agno/agent/_response.py:696-716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/company/manager.py:359 — libs/agno/agno/company/manager.py:359-379 | libs/agno/agno/company/manager.py:1252-1272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2046 — libs/agno/agno/db/mongo/async_mongo.py:2046-2066 | libs/agno/agno/db/mongo/mongo.py:1850-1870 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:215 — libs/agno/agno/db/postgres/async_postgres.py:215-235 | libs/agno/agno/db/postgres/postgres.py:255-275 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1241 — libs/agno/agno/db/postgres/async_postgres.py:1241-1261 | REDACTED:1199-1219 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1262` calls `_collect_sandbox_leftovers` and `REDACTED:1220` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4102 — libs/agno/agno/db/postgres/async_postgres.py:4102-4122 | REDACTED:4237-4257 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4554 — libs/agno/agno/db/postgres/async_postgres.py:4554-4574 | REDACTED:4627-4647 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4657 — libs/agno/agno/db/postgres/async_postgres.py:4657-4677 | libs/agno/agno/db/postgres/postgres.py:7407-7427 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5932 — libs/agno/agno/db/postgres/async_postgres.py:5932-5952 | REDACTED:5099-5119 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/postgres.py:4629 — libs/agno/agno/db/postgres/postgres.py:4629-4649 | REDACTED:4471-4491 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:4629` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/postgres.py:6127 — libs/agno/agno/db/postgres/postgres.py:6127-6147 | REDACTED:5916-5936 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/db/postgres/postgres.py:6834 — libs/agno/agno/db/postgres/postgres.py:6834-6854 | REDACTED:6605-6625 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) REDACTED:973 — REDACTED:973-993 | REDACTED:1158-1178 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:973` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) libs/agno/agno/knowledge/remote_content/s3.py:68 — libs/agno/agno/knowledge/remote_content/s3.py:68-88 | libs/agno/agno/knowledge/remote_content/s3.py:243-263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/learn/stores/user_memory.py:770 — libs/agno/agno/learn/stores/user_memory.py:770-790 | libs/agno/agno/learn/stores/user_profile.py:858-878 — before extracting anything, compare `libs/agno/agno/learn/stores/user_memory.py` and `libs/agno/agno/learn/stores/user_profile.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 305 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/user_memory.py:770` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) libs/agno/agno/learn/stores/user_memory.py:833 — libs/agno/agno/learn/stores/user_memory.py:833-853 | libs/agno/agno/learn/stores/user_profile.py:918-938 — before extracting anything, compare `libs/agno/agno/learn/stores/user_memory.py` and `libs/agno/agno/learn/stores/user_profile.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 305 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/user_memory.py:833` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) libs/agno/agno/memory/strategies/summarize.py:99 — libs/agno/agno/memory/strategies/summarize.py:99-119 | libs/agno/agno/memory/strategies/summarize.py:176-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (21 lines × 2) libs/agno/agno/os/router.py:751 — libs/agno/agno/os/router.py:751-773 | libs/agno/agno/os/router.py:858-878 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/router.py:751` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/os/routers/workflows/router.py:1307 — libs/agno/agno/os/routers/workflows/router.py:1307-1327 | libs/agno/agno/os/routers/workflows/router.py:1415-1435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) libs/agno/agno/team/_messages.py:1056 — libs/agno/agno/team/_messages.py:1056-1076 | libs/agno/agno/team/_messages.py:1190-1210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_messages.py:1056` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (21 lines × 2) libs/agno/agno/team/_run.py:364 — libs/agno/agno/team/_run.py:364-384 | libs/agno/agno/team/_run.py:2261-2281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 12 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×36
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_hooks.py:128 — libs/agno/agno/agent/_hooks.py:128-151 | libs/agno/agno/agent/_hooks.py:236-259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_response.py:371 — libs/agno/agno/agent/_response.py:371-394 | libs/agno/agno/agent/_response.py:419-442 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:371` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_run.py:1874 — libs/agno/agno/agent/_run.py:1874-1897 | libs/agno/agno/agent/_run.py:5106-5129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5105` calls `RunOutput` and `libs/agno/agno/agent/_run.py:1873` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_run.py:2857 — libs/agno/agno/agent/_run.py:2857-2880 | libs/agno/agno/team/_run.py:4265-4288 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2857` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_run_options.py:135 — libs/agno/agno/agent/_run_options.py:135-158 | libs/agno/agno/team/_run_options.py:131-154 — `libs/agno/agno/agent/_run_options.py` and `libs/agno/agno/team/_run_options.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_storage.py:569 — libs/agno/agno/agent/_storage.py:569-592 | libs/agno/agno/team/_storage.py:470-493 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `session` to `AgentSession` in one and `TeamSession` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (24 lines × 2) libs/agno/agno/agent/_storage.py:1141 — libs/agno/agno/agent/_storage.py:1141-1164 | libs/agno/agno/team/_storage.py:706-729 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/json/json_db.py:1985 — libs/agno/agno/db/json/json_db.py:1985-2008 | libs/agno/agno/db/redis/redis.py:2275-2298 — before extracting anything, compare `libs/agno/agno/db/json/json_db.py` and `libs/agno/agno/db/redis/redis.py` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) REDACTED:1902 — REDACTED:1902-1925 | REDACTED:1995-2018 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3229 — libs/agno/agno/db/postgres/async_postgres.py:3229-3252 | libs/agno/agno/db/postgres/postgres.py:3773-3796 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3229` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4807 — libs/agno/agno/db/postgres/async_postgres.py:4807-4830 | REDACTED:4897-4920 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/postgres/postgres.py:1494 — libs/agno/agno/db/postgres/postgres.py:1494-1517 | REDACTED:1473-1496 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/postgres/postgres.py:8572 — libs/agno/agno/db/postgres/postgres.py:8572-8595 | REDACTED:7504-7527 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/redis/redis.py:135 — libs/agno/agno/db/redis/redis.py:135-158 | libs/agno/agno/db/valkey/valkey.py:190-213 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) libs/agno/agno/db/redis/redis.py:1878 — libs/agno/agno/db/redis/redis.py:1878-1901 | libs/agno/agno/db/valkey/valkey.py:2312-2335 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) REDACTED:2035 — REDACTED:2035-2058 | REDACTED:2292-2315 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2035` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) libs/agno/agno/guardrails/openai.py:75 — libs/agno/agno/guardrails/openai.py:75-98 | libs/agno/agno/guardrails/openai.py:121-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) libs/agno/agno/learn/stores/session_context.py:540 — libs/agno/agno/learn/stores/session_context.py:540-563 | libs/agno/agno/learn/stores/session_context.py:610-633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/session_context.py:540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) libs/agno/agno/memory/manager.py:1460 — libs/agno/agno/memory/manager.py:1460-1483 | libs/agno/agno/memory/manager.py:1505-1528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: `UserMemory` names `agno.db.base` in one and `agno.db.schemas` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (24 lines × 2) REDACTED:1428 — REDACTED:1428-1451 | REDACTED:1709-1732 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1428` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) REDACTED:1453 — REDACTED:1453-1476 | REDACTED:1734-1757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1453` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) libs/agno/agno/offload/runs.py:76 — libs/agno/agno/offload/runs.py:76-99 | libs/agno/agno/offload/runs.py:140-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/offload/runs.py:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) libs/agno/agno/os/routers/workflows/router.py:294 — libs/agno/agno/os/routers/workflows/router.py:294-317 | libs/agno/agno/os/routers/workflows/router.py:878-901 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) libs/agno/agno/team/_run.py:268 — libs/agno/agno/team/_run.py:268-291 | libs/agno/agno/team/_run.py:616-639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:268` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) libs/agno/agno/tools/function.py:2696 — libs/agno/agno/tools/function.py:2696-2719 | libs/agno/agno/tools/function.py:2984-3007 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×34
  • Duplicated block (22 lines × 2) cookbook/02_agents/09_hooks/post_hook_output.py:73 — cookbook/02_agents/09_hooks/post_hook_output.py:73-94 | cookbook/03_teams/13_hooks/post_hook_output.py:107-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (22 lines × 2) libs/agno/agno/agent/_run.py:2099 — libs/agno/agno/agent/_run.py:2099-2120 | libs/agno/agno/team/_run.py:3592-3613 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (22 lines × 2) libs/agno/agno/agent/_run.py:2669 — libs/agno/agno/agent/_run.py:2669-2690 | libs/agno/agno/agent/_run.py:5796-5817 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) libs/agno/agno/agent/_run_options.py:165 — libs/agno/agno/agent/_run_options.py:165-186 | libs/agno/agno/team/_run_options.py:161-182 — `libs/agno/agno/agent/_run_options.py` and `libs/agno/agno/team/_run_options.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/context/web/exa.py:71 — libs/agno/agno/context/web/exa.py:71-92 | libs/agno/agno/context/web/parallel.py:160-181 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:655 — libs/agno/agno/db/gcs_json/gcs_json_db.py:655-676 | libs/agno/agno/db/json/json_db.py:704-725 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/json/json_db.py:727` calls `log_debug` and `libs/agno/agno/db/gcs_json/gcs_json_db.py:678` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1976 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1976-1997 | libs/agno/agno/db/json/json_db.py:2071-2092 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2807 — libs/agno/agno/db/mongo/async_mongo.py:2807-2828 | libs/agno/agno/db/mongo/mongo.py:2671-2692 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:579 — libs/agno/agno/db/mysql/async_mysql.py:579-600 | REDACTED:831-852 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:579` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1895 — libs/agno/agno/db/mysql/async_mysql.py:1895-1916 | libs/agno/agno/db/mysql/mysql.py:1869-1890 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1895` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/mysql/mysql.py:857 — libs/agno/agno/db/mysql/mysql.py:857-878 | libs/agno/agno/db/singlestore/singlestore.py:911-932 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/mysql/mysql.py:2126 — libs/agno/agno/db/mysql/mysql.py:2126-2147 | libs/agno/agno/db/singlestore/singlestore.py:2151-2172 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/mysql/mysql.py:2457 — libs/agno/agno/db/mysql/mysql.py:2457-2478 | libs/agno/agno/db/singlestore/singlestore.py:2449-2470 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/singlestore/singlestore.py:2472` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:2480` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5283 — libs/agno/agno/db/postgres/async_postgres.py:5283-5304 | libs/agno/agno/db/postgres/postgres.py:7977-7998 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/db/postgres/postgres.py:7301 — libs/agno/agno/db/postgres/postgres.py:7301-7322 | REDACTED:7069-7090 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/guardrails/pii.py:57 — libs/agno/agno/guardrails/pii.py:57-78 | libs/agno/agno/guardrails/pii.py:81-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) libs/agno/agno/models/cerebras/cerebras.py:76 — libs/agno/agno/models/cerebras/cerebras.py:76-97 | libs/agno/agno/models/meta/llama.py:73-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (22 lines × 2) libs/agno/agno/offload/store.py:686 — libs/agno/agno/offload/store.py:686-707 | libs/agno/agno/offload/store.py:725-746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/offload/store.py:686` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) libs/agno/agno/os/routers/agents/router.py:779 — libs/agno/agno/os/routers/agents/router.py:779-800 | libs/agno/agno/os/routers/workflows/router.py:1872-1893 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/workflows/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 413 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:779` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) libs/agno/agno/os/routers/agents/router.py:2314 — libs/agno/agno/os/routers/agents/router.py:2314-2335 | libs/agno/agno/os/routers/teams/router.py:2197-2218 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2314` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) libs/agno/agno/team/_hooks.py:314 — libs/agno/agno/team/_hooks.py:314-335 | libs/agno/agno/team/_hooks.py:417-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_hooks.py:414` calls `iscoroutinefunction`, `hook` and `libs/agno/agno/team/_hooks.py:312` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 2) libs/agno/agno/team/_response.py:241 — libs/agno/agno/team/_response.py:241-262 | libs/agno/agno/team/_response.py:312-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) libs/agno/agno/team/_run.py:3161 — libs/agno/agno/team/_run.py:3161-3182 | libs/agno/agno/team/_run.py:3736-3757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:3161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) libs/agno/agno/team/_run.py:8528 — libs/agno/agno/team/_run.py:8528-8549 | libs/agno/agno/team/_run.py:10366-10387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:8528` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) libs/agno/agno/tools/google/gmail.py:853 — libs/agno/agno/tools/google/gmail.py:853-874 | libs/agno/agno/tools/google/gmail.py:878-899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×33
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_default_tools.py:215 — libs/agno/agno/agent/_default_tools.py:215-240 | libs/agno/agno/team/_default_tools.py:1717-1742 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_default_tools.py:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_messages.py:727 — libs/agno/agno/agent/_messages.py:727-752 | libs/agno/agno/agent/_messages.py:798-823 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:727` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_run.py:919 — libs/agno/agno/agent/_run.py:919-944 | libs/agno/agno/agent/_run.py:2278-2303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:919` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_run.py:2442 — libs/agno/agno/agent/_run.py:2442-2467 | libs/agno/agno/agent/_run.py:5571-5596 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_run.py:5902 — libs/agno/agno/agent/_run.py:5902-5927 | libs/agno/agno/team/_run.py:4399-4424 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `TeamRunOutput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_tools.py:286 — libs/agno/agno/agent/_tools.py:286-311 | libs/agno/agno/agent/_tools.py:433-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) libs/agno/agno/agent/_tools.py:523 — libs/agno/agno/agent/_tools.py:523-548 | libs/agno/agno/team/_tools.py:382-407 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:523` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `Agent` names `agno.agent` in one and `agno.agent.agent` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (26 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2855 — libs/agno/agno/db/mysql/async_mysql.py:2855-2880 | libs/agno/agno/db/mysql/mysql.py:2822-2847 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2855` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/db/postgres/postgres.py:6331 — libs/agno/agno/db/postgres/postgres.py:6331-6356 | REDACTED:6115-6140 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/db/redis/redis.py:1364 — libs/agno/agno/db/redis/redis.py:1364-1389 | libs/agno/agno/db/valkey/valkey.py:1734-1759 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/valkey/valkey.py:1765` calls `_get_sessions_runs_data`, `get` and `libs/agno/agno/db/redis/redis.py:1395` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (26 lines × 2) libs/agno/agno/db/redis/redis.py:1413 — libs/agno/agno/db/redis/redis.py:1413-1438 | libs/agno/agno/db/valkey/valkey.py:1786-1811 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/db/redis/redis.py:1680 — libs/agno/agno/db/redis/redis.py:1680-1705 | libs/agno/agno/db/valkey/valkey.py:2066-2091 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) REDACTED:1843 — REDACTED:1843-1868 | REDACTED:2100-2125 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (26 lines × 2) REDACTED:2397 — REDACTED:2397-2422 | REDACTED:2652-2677 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (26 lines × 2) REDACTED:3381 — REDACTED:3381-3406 | REDACTED:3577-3602 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3381` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/knowledge/knowledge.py:3508 — libs/agno/agno/knowledge/knowledge.py:3508-3533 | libs/agno/agno/knowledge/knowledge.py:3703-3728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/knowledge.py:3508` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/knowledge/knowledge.py:3792 — libs/agno/agno/knowledge/knowledge.py:3792-3817 | libs/agno/agno/knowledge/knowledge.py:3905-3930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26 lines × 2) libs/agno/agno/learn/stores/decision_log.py:585 — libs/agno/agno/learn/stores/decision_log.py:585-610 | libs/agno/agno/learn/stores/decision_log.py:629-654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/decision_log.py:585` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) REDACTED:1523 — REDACTED:1523-1548 | REDACTED:1804-1829 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1523` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) REDACTED:2378 — REDACTED:2378-2403 | REDACTED:3078-3103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2378` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) REDACTED:2522 — REDACTED:2522-2547 | REDACTED:2743-2768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26 lines × 2) libs/agno/agno/offload/tools.py:62 — libs/agno/agno/offload/tools.py:62-88 | libs/agno/agno/offload/tools.py:97-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/offload/tools.py:97` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) libs/agno/agno/os/routers/agents/router.py:849 — libs/agno/agno/os/routers/agents/router.py:849-874 | libs/agno/agno/os/routers/teams/router.py:776-801 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26 lines × 2) libs/agno/agno/os/routers/agents/router.py:2374 — libs/agno/agno/os/routers/agents/router.py:2374-2399 | libs/agno/agno/os/routers/teams/router.py:2257-2282 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2374` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) libs/agno/agno/reasoning/openai.py:148 — libs/agno/agno/reasoning/openai.py:148-173 | libs/agno/agno/reasoning/openai.py:204-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 8 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×33
  • Swallowed exception (caught, then discarded) libs/agnoctl/agnoctl/http.py:147 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agnoctl/agnoctl/clients/__init__.py:80 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno_infra/agno/aws/resource/cloudformation/stack.py:163 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/migrations/v2_to_v3/migrate_sentinel_vectordbs.py:225 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/condition.py:467 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/remote.py:424 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/router.py:524 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/router.py:618 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/step.py:1367 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/workflow.py:11743 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/workflow.py:11749 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/workflow/workflow.py:11913 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) libs/agno/agno/vectordb/redis/redisdb.py:274 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:247 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:615 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:665 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:715 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:1360 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:953 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:1254 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:1438 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:1603 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:1664 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:147 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:632 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • + 8 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×32
  • Duplicated block (23 lines × 2) cookbook/03_teams/25_time_travel/01_continue_from.py:38 — cookbook/03_teams/25_time_travel/01_continue_from.py:38-60 | cookbook/03_teams/25_time_travel/02_fork_run.py:35-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/03_teams/25_time_travel/01_continue_from.py:38` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:44 — cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:44-66 | cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:47-69 — before extracting anything, compare `cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py` and `cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (23 lines × 2) libs/agno/agno/agent/_default_tools.py:189 — libs/agno/agno/agent/_default_tools.py:189-211 | libs/agno/agno/team/_default_tools.py:1693-1715 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (23 lines × 2) libs/agno/agno/agent/_run.py:1151 — libs/agno/agno/agent/_run.py:1151-1173 | libs/agno/agno/agent/_run.py:2505-2527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1151` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) libs/agno/agno/agent/_run.py:4044 — libs/agno/agno/agent/_run.py:4044-4066 | libs/agno/agno/agent/_run.py:5621-5643 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:4044` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) libs/agno/agno/agent/_session.py:802 — libs/agno/agno/agent/_session.py:802-824 | libs/agno/agno/agent/_session.py:858-880 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/agent/_utils.py:74 — libs/agno/agno/agent/_utils.py:74-96 | libs/agno/agno/team/_utils.py:72-94 — `libs/agno/agno/agent/_utils.py` and `libs/agno/agno/team/_utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 107 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/agents/base.py:662 — libs/agno/agno/agents/base.py:662-684 | libs/agno/agno/agents/base.py:708-730 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:929 — libs/agno/agno/db/gcs_json/gcs_json_db.py:929-951 | libs/agno/agno/db/json/json_db.py:996-1018 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) REDACTED:272 — REDACTED:272-294 | REDACTED:371-393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) REDACTED:353 — REDACTED:353-375 | REDACTED:674-696 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1105 — libs/agno/agno/db/mysql/async_mysql.py:1105-1127 | libs/agno/agno/db/postgres/async_postgres.py:1688-1710 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) libs/agno/agno/db/postgres/utils.py:215 — libs/agno/agno/db/postgres/utils.py:215-237 | libs/agno/agno/db/postgres/utils.py:250-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/utils.py:215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/db/singlestore/singlestore.py:2412 — libs/agno/agno/db/singlestore/singlestore.py:2412-2434 | REDACTED:3215-3237 — `libs/agno/agno/db/singlestore/singlestore.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 97 separate duplicated blocks between them, totalling at least 1641 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (23 lines × 2) libs/agno/agno/db/sqlite/utils.py:179 — libs/agno/agno/db/sqlite/utils.py:179-201 | libs/agno/agno/db/sqlite/utils.py:212-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/sqlite/utils.py:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/eval/performance.py:551 — libs/agno/agno/eval/performance.py:551-573 | libs/agno/agno/eval/performance.py:691-713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) libs/agno/agno/knowledge/knowledge.py:2557 — libs/agno/agno/knowledge/knowledge.py:2557-2579 | libs/agno/agno/knowledge/knowledge.py:2748-2770 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) libs/agno/agno/knowledge/knowledge.py:3570 — libs/agno/agno/knowledge/knowledge.py:3570-3592 | libs/agno/agno/knowledge/knowledge.py:3761-3783 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) libs/agno/agno/knowledge/knowledge.py:4017 — libs/agno/agno/knowledge/knowledge.py:4017-4039 | libs/agno/agno/knowledge/knowledge.py:4078-4100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/knowledge/loaders/github.py:343 — libs/agno/agno/knowledge/loaders/github.py:343-365 | libs/agno/agno/knowledge/loaders/github.py:502-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/models/google/gemini.py:568 — libs/agno/agno/models/google/gemini.py:568-590 | libs/agno/agno/models/google/gemini.py:683-705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/google/gemini.py:568` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) libs/agno/agno/os/routers/agents/router.py:1269 — libs/agno/agno/os/routers/agents/router.py:1269-1291 | libs/agno/agno/os/routers/agents/router.py:1323-1345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1269` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) libs/agno/agno/os/utils.py:3107 — libs/agno/agno/os/utils.py:3107-3129 | libs/agno/agno/os/utils.py:3188-3210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/utils.py:3107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (23 lines × 2) libs/agno/agno/team/_run.py:9600 — libs/agno/agno/team/_run.py:9600-9622 | libs/agno/agno/team/_run.py:9649-9671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23 lines × 2) libs/agno/agno/team/_task_tools.py:504 — libs/agno/agno/team/_task_tools.py:504-526 | libs/agno/agno/team/_task_tools.py:687-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×27
  • Duplicated block (12–13 lines × 2) cookbook/04_workflows/06_advanced_concepts/structured_io/structured_io_function.py:95 — cookbook/04_workflows/06_advanced_concepts/structured_io/structured_io_function.py:95-107 | cookbook/04_workflows/06_advanced_concepts/structured_io/structured_io_function.py:160-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:134 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:134-146 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:198-209 — before extracting anything, compare `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py` and `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/agent/_default_tools.py:382 — libs/agno/agno/agent/_default_tools.py:382-394 | libs/agno/agno/team/_default_tools.py:1550-1561 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/agent/_init.py:282 — libs/agno/agno/agent/_init.py:282-294 | libs/agno/agno/team/_init.py:689-700 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/agent/_response.py:793 — libs/agno/agno/agent/_response.py:793-804 | libs/agno/agno/tools/reasoning.py:141-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:793` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/agent/_tools.py:786 — libs/agno/agno/agent/_tools.py:786-798 | libs/agno/agno/agent/_tools.py:811-822 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:786` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:1385 — libs/agno/agno/db/dynamo/dynamo.py:1385-1397 | libs/agno/agno/db/dynamo/dynamo.py:1456-1467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) REDACTED:888 — REDACTED:888-899 | REDACTED:1091-1103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2162 — libs/agno/agno/db/mongo/async_mongo.py:2162-2173 | libs/agno/agno/db/mongo/mongo.py:1966-1978 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6339 — libs/agno/agno/db/postgres/async_postgres.py:6339-6351 | REDACTED:5509-5520 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/db/postgres/postgres.py:9092 — libs/agno/agno/db/postgres/postgres.py:9092-9104 | REDACTED:8022-8033 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:9092` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/knowledge/knowledge.py:3033 — libs/agno/agno/knowledge/knowledge.py:3033-3045 | libs/agno/agno/knowledge/knowledge.py:3147-3158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/learn/migrations.py:224 — libs/agno/agno/learn/migrations.py:224-236 | libs/agno/agno/learn/migrations.py:246-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/migrations.py:246` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/learn/migrations.py:423 — libs/agno/agno/learn/migrations.py:423-435 | libs/agno/agno/learn/migrations.py:543-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/migrations.py:543` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/memory/manager.py:457 — libs/agno/agno/memory/manager.py:457-468 | libs/agno/agno/memory/manager.py:536-548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/models/groq/groq.py:328 — libs/agno/agno/models/groq/groq.py:328-339 | libs/agno/agno/models/groq/groq.py:412-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/groq/groq.py:328` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/os/routers/components/components.py:1225 — libs/agno/agno/os/routers/components/components.py:1225-1236 | libs/agno/agno/os/routers/components/components.py:1292-1304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/components/components.py:1225` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/os/routers/learnings/router.py:290 — libs/agno/agno/os/routers/learnings/router.py:290-301 | libs/agno/agno/os/routers/learnings/router.py:310-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/learnings/router.py:290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/tools/daytona.py:374 — libs/agno/agno/tools/daytona.py:374-386 | libs/agno/agno/tools/daytona.py:408-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/tools/daytona.py:406` calls `Path`, `_get_working_directory` and `libs/agno/agno/tools/daytona.py:371` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/tools/searchapi.py:79 — libs/agno/agno/tools/searchapi.py:79-90 | libs/agno/agno/tools/serply.py:81-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/serply.py:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/tools/zep.py:122 — libs/agno/agno/tools/zep.py:122-134 | libs/agno/agno/tools/zep.py:333-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) libs/agno/agno/utils/callables.py:317 — libs/agno/agno/utils/callables.py:317-329 | libs/agno/agno/utils/callables.py:355-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) REDACTED:153 — REDACTED:153-165 | REDACTED:201-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:153` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) REDACTED:457 — REDACTED:457-469 | REDACTED:539-550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:470` calls `exception` and `REDACTED:551` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–13 lines × 2) libs/agno_infra/agno/aws/resources.py:106 — libs/agno_infra/agno/aws/resources.py:106-118 | libs/agno_infra/agno/docker/resources.py:64-75 — `libs/agno_infra/agno/aws/resources.py` and `libs/agno_infra/agno/docker/resources.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 145 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resources.py:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×26
  • Duplicated block (30 lines × 2) libs/agno/agno/agent/_default_tools.py:146 — libs/agno/agno/agent/_default_tools.py:146-175 | libs/agno/agno/team/_default_tools.py:1652-1681 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_default_tools.py:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) libs/agno/agno/agent/_messages.py:1985 — libs/agno/agno/agent/_messages.py:1985-2014 | libs/agno/agno/agent/_messages.py:2200-2229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1985` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) libs/agno/agno/agent/_response.py:1476 — libs/agno/agno/agent/_response.py:1476-1505 | libs/agno/agno/team/_response.py:1430-1459 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (30 lines × 2) libs/agno/agno/agent/_run.py:1637 — libs/agno/agno/agent/_run.py:1637-1666 | libs/agno/agno/agent/_run.py:2254-2283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1637` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) libs/agno/agno/agent/_run.py:1993 — libs/agno/agno/agent/_run.py:1993-2022 | libs/agno/agno/team/_run.py:3488-3517 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (30 lines × 2) libs/agno/agno/agent/_utils.py:232 — libs/agno/agno/agent/_utils.py:232-261 | libs/agno/agno/team/_utils.py:231-260 — `libs/agno/agno/agent/_utils.py` and `libs/agno/agno/team/_utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 107 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/client/os.py:1249 — libs/agno/agno/client/os.py:1249-1278 | libs/agno/agno/client/os.py:1299-1328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:610 — libs/agno/agno/db/gcs_json/gcs_json_db.py:610-639 | libs/agno/agno/db/json/json_db.py:659-688 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2251 — libs/agno/agno/db/mysql/async_mysql.py:2251-2280 | libs/agno/agno/db/postgres/async_postgres.py:2597-2626 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (30 lines × 2) libs/agno/agno/db/postgres/postgres.py:7366 — libs/agno/agno/db/postgres/postgres.py:7366-7395 | REDACTED:7134-7163 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/db/postgres/postgres.py:8844 — libs/agno/agno/db/postgres/postgres.py:8844-8873 | REDACTED:7775-7804 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (30 lines × 2) libs/agno/agno/db/redis/redis.py:1966 — libs/agno/agno/db/redis/redis.py:1966-1995 | libs/agno/agno/db/valkey/valkey.py:2400-2429 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:1966` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) libs/agno/agno/db/redis/redis.py:2227 — libs/agno/agno/db/redis/redis.py:2227-2256 | libs/agno/agno/db/singlestore/singlestore.py:3028-3057 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/eval/agent_as_judge.py:315 — libs/agno/agno/eval/agent_as_judge.py:315-344 | libs/agno/agno/eval/agent_as_judge.py:372-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (30 lines × 2) libs/agno/agno/eval/performance.py:583 — libs/agno/agno/eval/performance.py:583-612 | libs/agno/agno/eval/performance.py:723-752 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (30 lines × 2) libs/agno/agno/team/_messages.py:1693 — libs/agno/agno/team/_messages.py:1693-1722 | libs/agno/agno/utils/prompts.py:66-95 — before extracting anything, compare `libs/agno/agno/team/_messages.py` and `libs/agno/agno/utils/prompts.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (30 lines × 2) libs/agno/agno/tools/studio.py:2408 — libs/agno/agno/tools/studio.py:2408-2437 | libs/agno/agno/tools/studio.py:2551-2580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio.py:2408` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/tools/studio.py:2550` calls `TeamMode` and `libs/agno/agno/tools/studio.py:2407` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (30 lines × 2) libs/agno/agno/utils/print_response/team.py:287 — libs/agno/agno/utils/print_response/team.py:287-316 | libs/agno/agno/utils/print_response/team.py:1220-1249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (30 lines × 2) libs/agno/agno/workflow/router.py:918 — libs/agno/agno/workflow/router.py:918-947 | libs/agno/agno/workflow/router.py:1259-1288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/router.py:918` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/workflow/steps.py:344 — libs/agno/agno/workflow/steps.py:344-373 | libs/agno/agno/workflow/steps.py:649-678 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/steps.py:341` calls `log_debug` and `libs/agno/agno/workflow/steps.py:646` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (30 lines × 2) libs/agno/agno/workflow/steps.py:458 — libs/agno/agno/workflow/steps.py:458-487 | libs/agno/agno/workflow/steps.py:763-792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/steps.py:458` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno/agno/workflow/workflow.py:7218 — libs/agno/agno/workflow/workflow.py:7218-7247 | libs/agno/agno/workflow/workflow.py:9276-9305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:7218` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) libs/agno_infra/agno/aws/resources.py:140 — libs/agno_infra/agno/aws/resources.py:140-169 | libs/agno_infra/agno/aws/resources.py:443-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resources.py:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) libs/agno_infra/agno/cli/operator.py:96 — libs/agno_infra/agno/cli/operator.py:96-125 | libs/agno_infra/agno/infra/operator.py:245-274 — `libs/agno_infra/agno/cli/operator.py` and `libs/agno_infra/agno/infra/operator.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 123 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/cli/operator.py:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30 lines × 2) libs/agno_infra/agno/docker/resources.py:299 — libs/agno_infra/agno/docker/resources.py:299-328 | libs/agno_infra/agno/docker/resources.py:455-484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×25
  • Duplicated block (27 lines × 2) libs/agno/agno/agent/_hooks.py:96 — libs/agno/agno/agent/_hooks.py:96-122 | libs/agno/agno/agent/_hooks.py:206-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/agent/_run.py:573 — libs/agno/agno/agent/_run.py:573-599 | libs/agno/agno/agent/_run.py:3724-3750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:573` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) libs/agno/agno/client/os.py:108 — libs/agno/agno/client/os.py:108-134 | libs/agno/agno/client/os.py:168-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1013 — libs/agno/agno/db/mongo/async_mongo.py:1013-1039 | libs/agno/agno/db/mongo/mongo.py:824-850 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2952 — libs/agno/agno/db/mongo/async_mongo.py:2952-2978 | libs/agno/agno/db/mongo/mongo.py:2816-2842 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:3200 — libs/agno/agno/db/mysql/async_mysql.py:3200-3226 | libs/agno/agno/db/mysql/mysql.py:3162-3188 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/mysql/mysql.py:1843 — libs/agno/agno/db/mysql/mysql.py:1843-1869 | libs/agno/agno/db/singlestore/singlestore.py:1867-1893 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1843` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/mysql/mysql.py:2391 — libs/agno/agno/db/mysql/mysql.py:2391-2417 | libs/agno/agno/db/postgres/postgres.py:3306-3332 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/postgres/postgres.py:6714 — libs/agno/agno/db/postgres/postgres.py:6714-6740 | REDACTED:6485-6511 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/postgres/postgres.py:7123 — libs/agno/agno/db/postgres/postgres.py:7123-7149 | REDACTED:6891-6917 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/postgres/postgres.py:7245 — libs/agno/agno/db/postgres/postgres.py:7245-7271 | REDACTED:7013-7039 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/redis/redis.py:1100 — libs/agno/agno/db/redis/redis.py:1100-1126 | libs/agno/agno/db/valkey/valkey.py:1394-1420 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/eval/accuracy.py:655 — libs/agno/agno/eval/accuracy.py:655-681 | libs/agno/agno/eval/accuracy.py:771-797 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/eval/accuracy.py:655` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) libs/agno/agno/eval/accuracy.py:684 — libs/agno/agno/eval/accuracy.py:684-710 | libs/agno/agno/eval/accuracy.py:800-826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/eval/accuracy.py:684` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/eval/accuracy.py:711` calls `isinstance`, `log_error` and `libs/agno/agno/eval/accuracy.py:827` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (27 lines × 2) libs/agno/agno/knowledge/knowledge.py:3852 — libs/agno/agno/knowledge/knowledge.py:3852-3878 | libs/agno/agno/knowledge/knowledge.py:3965-3991 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/os/app.py:989 — libs/agno/agno/os/app.py:989-1015 | libs/agno/agno/os/app.py:1899-1925 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27 lines × 2) libs/agno/agno/os/routers/agents/router.py:162 — libs/agno/agno/os/routers/agents/router.py:162-188 | libs/agno/agno/os/routers/agents/router.py:258-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:162` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/team/_messages.py:463 — libs/agno/agno/team/_messages.py:463-489 | libs/agno/agno/team/_messages.py:717-743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_messages.py:463` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/tools/perplexity.py:92 — libs/agno/agno/tools/perplexity.py:92-118 | libs/agno/agno/tools/perplexity.py:153-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/perplexity.py:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/utils/agent.py:908 — libs/agno/agno/utils/agent.py:908-934 | libs/agno/agno/utils/agent.py:956-982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) REDACTED:1283 — REDACTED:1283-1309 | REDACTED:1371-1397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (27 lines × 2) REDACTED:1898 — REDACTED:1898-1924 | REDACTED:1656-1682 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 2) libs/agno/agno/workflow/condition.py:589 — libs/agno/agno/workflow/condition.py:589-615 | libs/agno/agno/workflow/condition.py:1042-1068 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/condition.py:587` calls `log_debug` and `libs/agno/agno/workflow/condition.py:1041` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (27 lines × 2) libs/agno/agno/workflow/router.py:533 — libs/agno/agno/workflow/router.py:533-559 | libs/agno/agno/workflow/router.py:573-599 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/router.py:601` calls `iscoroutinefunction`, `selector` and `libs/agno/agno/workflow/router.py:561` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (27 lines × 2) libs/agno/agno/db/redis/schemas.py:118 — libs/agno/agno/db/redis/schemas.py:118-144 | libs/agno/agno/db/valkey/schemas.py:137-164 — `libs/agno/agno/db/redis/schemas.py` and `libs/agno/agno/db/valkey/schemas.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 28 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×25
  • Duplicated block (11 lines × 3) cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:92 — cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:92-103 | cookbook/05_agent_os/05_human_in_the_loop/basic.py:88-99 | cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py:115-125 — before extracting anything, compare `cookbook/05_agent_os/05_human_in_the_loop/basic.py` and `cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) cookbook/91_tools/mcp/pipedream_google_calendar.py:29 — cookbook/91_tools/mcp/pipedream_google_calendar.py:29-39 | cookbook/91_tools/mcp/pipedream_linkedin.py:29-39 | cookbook/91_tools/mcp/pipedream_slack.py:30-40 — before extracting anything, compare `cookbook/91_tools/mcp/pipedream_google_calendar.py` and `cookbook/91_tools/mcp/pipedream_linkedin.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/91_tools/mcp/pipedream_slack.py:50` calls `run`, `run_agent` and `cookbook/91_tools/mcp/pipedream_google_calendar.py:48` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) libs/agno/agno/agent/_storage.py:1661 — libs/agno/agno/agent/_storage.py:1661-1671 | libs/agno/agno/team/_storage.py:1643-1653 | libs/agno/agno/workflow/workflow.py:1520-1530 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/client/os.py:684 — libs/agno/agno/client/os.py:684-694 | libs/agno/agno/client/os.py:985-995 | libs/agno/agno/client/os.py:1276-1286 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno/agno/client/os.py:726 — libs/agno/agno/client/os.py:726-736 | libs/agno/agno/client/os.py:1039-1049 | libs/agno/agno/client/os.py:1326-1336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/base.py:2763 — libs/agno/agno/db/base.py:2763-2773 | libs/agno/agno/db/postgres/async_postgres.py:274-284 | REDACTED:260-270 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:526 — libs/agno/agno/db/gcs_json/gcs_json_db.py:526-536 | libs/agno/agno/db/json/json_db.py:575-585 | libs/agno/agno/db/valkey/valkey.py:820-830 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:1215 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1215-1225 | libs/agno/agno/db/json/json_db.py:1284-1294 | libs/agno/agno/db/valkey/valkey.py:1771-1781 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:691 — libs/agno/agno/db/mysql/async_mysql.py:691-701 | libs/agno/agno/db/mysql/mysql.py:678-688 | libs/agno/agno/db/singlestore/singlestore.py:747-757 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:976 — libs/agno/agno/db/mysql/async_mysql.py:976-986 | libs/agno/agno/db/mysql/mysql.py:971-981 | libs/agno/agno/db/singlestore/singlestore.py:1026-1036 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2874 — libs/agno/agno/db/mysql/async_mysql.py:2874-2884 | libs/agno/agno/db/mysql/mysql.py:2841-2851 | libs/agno/agno/db/singlestore/singlestore.py:2782-2792 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2874` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/mysql/mysql.py:545 — libs/agno/agno/db/mysql/mysql.py:545-555 | libs/agno/agno/db/singlestore/singlestore.py:624-634 | REDACTED:1030-1040 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:545` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/db/postgres/async_postgres.py:843 — libs/agno/agno/db/postgres/async_postgres.py:843-853 | libs/agno/agno/db/postgres/postgres.py:1000-1010 | REDACTED:796-806 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 3) libs/agno/agno/os/interfaces/a2a/utils.py:219 — libs/agno/agno/os/interfaces/a2a/utils.py:219-229 | libs/agno/agno/os/interfaces/a2a/utils.py:232-242 | libs/agno/agno/os/interfaces/a2a/utils.py:245-255 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno/agno/os/interfaces/a2a/utils.py:661 — libs/agno/agno/os/interfaces/a2a/utils.py:661-671 | libs/agno/agno/os/interfaces/a2a/utils.py:698-708 | libs/agno/agno/os/interfaces/a2a/utils.py:735-745 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno/agno/os/interfaces/a2a/utils.py:833 — libs/agno/agno/os/interfaces/a2a/utils.py:833-843 | libs/agno/agno/os/interfaces/a2a/utils.py:846-856 | libs/agno/agno/os/interfaces/a2a/utils.py:859-869 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno/agno/os/routers/components/components.py:884 — libs/agno/agno/os/routers/components/components.py:884-894 | libs/agno/agno/os/routers/components/components.py:1137-1147 | libs/agno/agno/os/routers/components/components.py:1234-1244 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno/agno/os/routers/filesystem/router.py:475 — libs/agno/agno/os/routers/filesystem/router.py:475-485 | libs/agno/agno/os/routers/filesystem/router.py:529-539 | libs/agno/agno/os/routers/filesystem/router.py:578-588 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/filesystem/router.py:475` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) libs/agno/agno/run/agent.py:1022 — libs/agno/agno/run/agent.py:1022-1032 | libs/agno/agno/run/team.py:1078-1088 | libs/agno/agno/run/workflow.py:1139-1149 — before extracting anything, compare `libs/agno/agno/run/agent.py` and `libs/agno/agno/run/team.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 181 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/team/team.py:1965 — libs/agno/agno/team/team.py:1965-1975 | libs/agno/agno/workflow/workflow.py:1551-1563 | libs/agno/agno/workflow/workflow.py:11996-12006 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/team.py:1962` calls `component_owner_scope` and `libs/agno/agno/workflow/workflow.py:1547` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) libs/agno/agno/tools/exa.py:176 — libs/agno/agno/tools/exa.py:176-186 | libs/agno/agno/tools/exa.py:211-221 | libs/agno/agno/tools/exa.py:254-264 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno/agno/tools/openweather.py:138 — libs/agno/agno/tools/openweather.py:138-148 | libs/agno/agno/tools/openweather.py:185-195 | libs/agno/agno/tools/openweather.py:225-235 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py:114 — libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py:114-124 | libs/agno_infra/agno/aws/resource/emr/cluster.py:210-220 | libs/agno_infra/agno/aws/resource/rds/db_subnet_group.py:119-129 — before extracting anything, compare `libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py` and `libs/agno_infra/agno/aws/resource/rds/db_subnet_group.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno_infra/agno/aws/resource/emr/cluster.py:223` calls `get` and `libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py:126` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) libs/agno_infra/agno/aws/resources.py:111 — libs/agno_infra/agno/aws/resources.py:111-121 | libs/agno_infra/agno/aws/resources.py:273-283 | libs/agno_infra/agno/aws/resources.py:430-440 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) libs/agno_infra/agno/aws/resources.py:148 — libs/agno_infra/agno/aws/resources.py:148-158 | libs/agno_infra/agno/aws/resources.py:294-304 | libs/agno_infra/agno/aws/resources.py:451-461 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×24
  • Duplicated block (10 lines × 4) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:106 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:106-115 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:91-100 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:110-119 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:182-191 — before extracting anything, compare `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py` and `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) libs/agno/agno/agent/_run.py:3841 — libs/agno/agno/agent/_run.py:3841-3850 | libs/agno/agno/agent/_run.py:4151-4160 | libs/agno/agno/agent/_run.py:5138-5147 | libs/agno/agno/agent/_run.py:5775-5784 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5774` calls `RunOutput` and `libs/agno/agno/agent/_run.py:4150` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1433 — libs/agno/agno/db/postgres/async_postgres.py:1433-1442 | libs/agno/agno/db/postgres/postgres.py:1603-1612 | REDACTED:1358-1367 | REDACTED:1554-1563 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1916 — libs/agno/agno/db/postgres/async_postgres.py:1916-1925 | libs/agno/agno/db/postgres/postgres.py:2145-2154 | REDACTED:1793-1802 | REDACTED:2050-2059 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1914` calls `log_debug` and `libs/agno/agno/db/postgres/postgres.py:2143` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3885 — libs/agno/agno/db/postgres/async_postgres.py:3885-3894 | libs/agno/agno/db/postgres/postgres.py:4424-4433 | REDACTED:4019-4028 | REDACTED:4213-4222 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3885` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:3884` calls `label` and `REDACTED:4018` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4209 — libs/agno/agno/db/postgres/async_postgres.py:4209-4218 | libs/agno/agno/db/postgres/postgres.py:6943-6952 | REDACTED:4348-4357 | REDACTED:6714-6723 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4602 — libs/agno/agno/db/postgres/async_postgres.py:4602-4611 | libs/agno/agno/db/postgres/postgres.py:7353-7362 | REDACTED:4675-4684 | REDACTED:7121-7130 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:4602` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4659 — libs/agno/agno/db/postgres/async_postgres.py:4659-4668 | libs/agno/agno/db/postgres/postgres.py:7409-7418 | REDACTED:4731-4740 | REDACTED:7176-7185 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:4659` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:5991 — libs/agno/agno/db/postgres/async_postgres.py:5991-6000 | libs/agno/agno/db/postgres/postgres.py:8756-8765 | REDACTED:5158-5167 | REDACTED:7688-7697 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5991` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6341 — libs/agno/agno/db/postgres/async_postgres.py:6341-6350 | libs/agno/agno/db/postgres/postgres.py:9094-9103 | REDACTED:5510-5519 | REDACTED:8023-8032 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6341` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6688 — libs/agno/agno/db/postgres/async_postgres.py:6688-6697 | libs/agno/agno/db/postgres/async_postgres.py:6939-6948 | REDACTED:5857-5866 | REDACTED:6108-6117 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7224 — libs/agno/agno/db/postgres/async_postgres.py:7224-7233 | libs/agno/agno/db/postgres/postgres.py:9949-9958 | REDACTED:6393-6402 | REDACTED:8878-8887 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/postgres.py:5173 — libs/agno/agno/db/postgres/postgres.py:5173-5182 | libs/agno/agno/db/postgres/postgres.py:5537-5549 | REDACTED:5013-5022 | REDACTED:5334-5344 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/postgres.py:5967 — libs/agno/agno/db/postgres/postgres.py:5967-5977 | libs/agno/agno/db/postgres/postgres.py:6057-6066 | REDACTED:5757-5767 | REDACTED:5847-5856 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/postgres.py:6925 — libs/agno/agno/db/postgres/postgres.py:6925-6934 | libs/agno/agno/db/postgres/postgres.py:6989-6998 | REDACTED:6696-6705 | REDACTED:6758-6767 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/postgres.py:6987` calls `learning_search_patterns` and `libs/agno/agno/db/postgres/postgres.py:6924` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/postgres.py:8546 — libs/agno/agno/db/postgres/postgres.py:8546-8555 | libs/agno/agno/db/postgres/postgres.py:8893-8902 | REDACTED:7478-7487 | REDACTED:7824-7833 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) libs/agno/agno/db/postgres/postgres.py:9433 — libs/agno/agno/db/postgres/postgres.py:9433-9442 | libs/agno/agno/db/postgres/postgres.py:9674-9683 | REDACTED:8362-8371 | REDACTED:8603-8612 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) libs/agno/agno/knowledge/embedder/cohere.py:59 — libs/agno/agno/knowledge/embedder/cohere.py:59-68 | libs/agno/agno/knowledge/embedder/cohere.py:73-82 | libs/agno/agno/knowledge/embedder/cohere.py:212-221 | libs/agno/agno/knowledge/embedder/cohere.py:238-247 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) libs/agno/agno/media/media.py:246 — libs/agno/agno/media/media.py:246-255 | libs/agno/agno/media/media.py:407-416 | libs/agno/agno/media/media.py:584-593 | libs/agno/agno/media/media.py:836-845 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/media/media.py:246` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) libs/agno/agno/models/groq/groq.py:306 — libs/agno/agno/models/groq/groq.py:306-315 | libs/agno/agno/models/groq/groq.py:348-357 | libs/agno/agno/models/groq/groq.py:390-399 | libs/agno/agno/models/groq/groq.py:433-442 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) libs/agno/agno/os/routers/workflows/router.py:310 — libs/agno/agno/os/routers/workflows/router.py:310-319 | libs/agno/agno/os/routers/workflows/router.py:323-332 | libs/agno/agno/os/routers/workflows/router.py:858-867 | libs/agno/agno/os/routers/workflows/router.py:894-903 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 4) libs/agno/agno/utils/print_response/team.py:285 — libs/agno/agno/utils/print_response/team.py:285-294 | libs/agno/agno/utils/print_response/team.py:901-910 | libs/agno/agno/utils/print_response/team.py:1218-1227 | libs/agno/agno/utils/print_response/team.py:1850-1859 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 4) REDACTED:510 — REDACTED:510-521 | REDACTED:546-555 | REDACTED:584-593 | REDACTED:643-652 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:544` calls `_validate_user_id`, `_require_owner_field` and `REDACTED:508` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 4) libs/agno/agno/workflow/condition.py:231 — libs/agno/agno/workflow/condition.py:231-240 | libs/agno/agno/workflow/loop.py:235-244 | libs/agno/agno/workflow/parallel.py:137-146 | libs/agno/agno/workflow/steps.py:146-155 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×23
  • Members sharing a duplicated core (6 members, 50+ identical tokens) cookbook/91_tools/file_generation_tools.py:35 — cookbook/91_tools/file_generation_tools.py:35-46 | cookbook/91_tools/file_generation_tools.py:50-61 | cookbook/91_tools/file_generation_tools.py:65-76 | cookbook/91_tools/file_generation_tools.py:80-91 | cookbook/91_tools/file_generation_tools.py:95-106 | cookbook/91_tools/file_generation_tools.py:110-121 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/agent/_run.py:6019 — libs/agno/agno/agent/_run.py:6019-6061 | libs/agno/agno/agent/_run.py:6071-6097 | libs/agno/agno/team/_run.py:4620-4692 | libs/agno/agno/team/_run.py:4701-4775 | libs/agno/agno/team/_run.py:4858-4910 | libs/agno/agno/team/_run.py:4919-4970 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/agent/_session.py:359 — libs/agno/agno/agent/_session.py:359-399 | libs/agno/agno/agent/_session.py:403-438 | libs/agno/agno/team/_session.py:785-826 | libs/agno/agno/team/_session.py:830-865 | libs/agno/agno/workflow/workflow.py:1131-1165 | libs/agno/agno/workflow/workflow.py:1168-1209 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/agent/remote.py:368 — libs/agno/agno/agent/remote.py:368-415 | libs/agno/agno/agent/remote.py:429-445 | libs/agno/agno/team/remote.py:361-407 | libs/agno/agno/team/remote.py:421-437 | libs/agno/agno/workflow/remote.py:275-318 | libs/agno/agno/workflow/remote.py:331-346 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/client/os.py:537 — libs/agno/agno/client/os.py:537-589 | libs/agno/agno/client/os.py:604-652 | libs/agno/agno/client/os.py:818-865 | libs/agno/agno/client/os.py:880-929 | libs/agno/agno/client/os.py:1127-1173 | libs/agno/agno/client/os.py:1188-1237 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/client/os.py:664 — libs/agno/agno/client/os.py:664-695 | libs/agno/agno/client/os.py:707-738 | libs/agno/agno/client/os.py:954-996 | libs/agno/agno/client/os.py:1008-1051 | libs/agno/agno/client/os.py:1249-1287 | libs/agno/agno/client/os.py:1299-1338 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/base.py:479 — libs/agno/agno/db/base.py:479-511 | libs/agno/agno/db/base.py:2756-2780 | libs/agno/agno/db/postgres/async_postgres.py:265-291 | libs/agno/agno/db/postgres/postgres.py:303-329 | REDACTED:251-276 | REDACTED:301-326 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/dynamo/dynamo.py:1099 — libs/agno/agno/db/dynamo/dynamo.py:1099-1131 | libs/agno/agno/db/firestore/firestore.py:1071-1103 | libs/agno/agno/db/gcs_json/gcs_json_db.py:748-780 | libs/agno/agno/db/in_memory/in_memory_db.py:432-461 | libs/agno/agno/db/json/json_db.py:801-833 | libs/agno/agno/db/redis/redis.py:971-1003 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/dynamo/dynamo.py:1551 — libs/agno/agno/db/dynamo/dynamo.py:1551-1583 | libs/agno/agno/db/firestore/firestore.py:1474-1505 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1048-1079 | libs/agno/agno/db/in_memory/in_memory_db.py:891-921 | libs/agno/agno/db/json/json_db.py:1115-1146 | libs/agno/agno/db/redis/redis.py:1307-1339 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/firestore/firestore.py:1368 — libs/agno/agno/db/firestore/firestore.py:1368-1423 | libs/agno/agno/db/gcs_json/gcs_json_db.py:962-1009 | libs/agno/agno/db/in_memory/in_memory_db.py:801-850 | libs/agno/agno/db/json/json_db.py:1029-1076 | libs/agno/agno/db/redis/redis.py:1207-1258 | libs/agno/agno/db/valkey/valkey.py:1501-1552 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:139 — REDACTED:139-270 | REDACTED:478-566 | REDACTED:695-774 | REDACTED:778-810 | REDACTED:851-915 | REDACTED:933-966 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:753 — REDACTED:753-811 | REDACTED:815-873 | REDACTED:882-926 | REDACTED:930-976 | REDACTED:1188-1262 | REDACTED:1266-1328 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py:1154 — libs/agno/agno/db/mongo/async_mongo.py:1154-1258 | libs/agno/agno/db/mongo/mongo.py:965-1067 | libs/agno/agno/db/mysql/mysql.py:1212-1306 | libs/agno/agno/db/redis/redis.py:860-966 | libs/agno/agno/db/singlestore/singlestore.py:1270-1365 | libs/agno/agno/db/valkey/valkey.py:990-1100 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:1579 — libs/agno/agno/db/mysql/async_mysql.py:1579-1605 | libs/agno/agno/db/mysql/async_mysql.py:2539-2562 | libs/agno/agno/db/postgres/async_postgres.py:1960-1987 | libs/agno/agno/db/postgres/async_postgres.py:2911-2934 | REDACTED:2101-2125 | REDACTED:3062-3085 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:1651 — libs/agno/agno/db/mysql/async_mysql.py:1651-1688 | libs/agno/agno/db/mysql/async_mysql.py:2567-2604 | libs/agno/agno/db/postgres/async_postgres.py:2049-2087 | libs/agno/agno/db/postgres/async_postgres.py:2939-2976 | REDACTED:2171-2207 | REDACTED:3090-3126 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py:4509 — libs/agno/agno/db/postgres/async_postgres.py:4509-4519 | libs/agno/agno/db/postgres/async_postgres.py:4734-4744 | libs/agno/agno/db/postgres/async_postgres.py:6005-6015 | REDACTED:4582-4592 | REDACTED:4824-4834 | REDACTED:5172-5182 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/db/postgres/postgres.py:7231 — libs/agno/agno/db/postgres/postgres.py:7231-7240 | libs/agno/agno/db/postgres/postgres.py:7482-7491 | libs/agno/agno/db/postgres/postgres.py:8770-8779 | REDACTED:6999-7008 | REDACTED:7267-7276 | REDACTED:7702-7711 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/learn/schemas.py:119 — libs/agno/agno/learn/schemas.py:119-146 | libs/agno/agno/learn/schemas.py:217-244 | libs/agno/agno/learn/schemas.py:384-407 | libs/agno/agno/learn/schemas.py:480-503 | libs/agno/agno/learn/schemas.py:622-645 | libs/agno/agno/learn/schemas.py:1112-1135 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/learn/stores/session_context.py:280 — libs/agno/agno/learn/stores/session_context.py:280-304 | libs/agno/agno/learn/stores/session_context.py:307-330 | libs/agno/agno/learn/stores/user_memory.py:438-462 | libs/agno/agno/learn/stores/user_memory.py:465-488 | libs/agno/agno/learn/stores/user_profile.py:606-630 | libs/agno/agno/learn/stores/user_profile.py:633-656 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/team/_run.py:250 — libs/agno/agno/team/_run.py:250-572 | libs/agno/agno/team/_run.py:1096-1439 | libs/agno/agno/team/_run.py:2131-2487 | libs/agno/agno/team/_run.py:3058-3449 | libs/agno/agno/team/_run.py:6842-6898 | libs/agno/agno/team/_run.py:8181-8362 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/tools/memory.py:67 — libs/agno/agno/tools/memory.py:67-95 | libs/agno/agno/tools/memory.py:310-336 | libs/agno/agno/tools/workflow.py:70-96 | libs/agno/agno/tools/workflow.py:99-125 | libs/agno/agno/tools/workflow.py:207-232 | libs/agno/agno/tools/workflow.py:235-260 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno/agno/tools/scheduler.py:756 — libs/agno/agno/tools/scheduler.py:756-783 | libs/agno/agno/tools/scheduler.py:809-891 | libs/agno/agno/tools/scheduler.py:895-920 | libs/agno/agno/tools/scheduler.py:1145-1172 | libs/agno/agno/tools/scheduler.py:1200-1282 | libs/agno/agno/tools/scheduler.py:1286-1313 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) libs/agno_infra/agno/aws/resource/ecs/cluster.py:46 — libs/agno_infra/agno/aws/resource/ecs/cluster.py:46-87 | libs/agno_infra/agno/aws/resource/ecs/service.py:122-224 | libs/agno_infra/agno/aws/resource/ecs/task_definition.py:96-181 | libs/agno_infra/agno/aws/resource/elb/listener.py:36-99 | libs/agno_infra/agno/aws/resource/elb/load_balancer.py:35-94 | libs/agno_infra/agno/aws/resource/elb/target_group.py:40-113 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×23
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/workflow/types.py:646 — `from_dict` is public and takes `data: Dict[str, Any]` from its caller, and it calls itself at line 646 (`self.from_dict`) with a piece of `data` — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/agent.py:567 — `scrub_workflow_media` is public and takes `run_response: Any` from its caller, and it calls itself at line 567 (`scrub_workflow_media`) with a piece of `run_response` — and nowhere in `scrub_workflow_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `scrub_workflow_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/common.py:77 — `check_type_compatibility` is public and takes `value: Any` from its caller, and it calls itself at line 77 (`check_type_compatibility`) with a piece of `value` — and nowhere in `check_type_compatibility` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `check_type_compatibility` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/copies.py:47 — `workflow_copy_divergence` is public, takes a document from its caller (line 53) and hands it to `_without_keys`, which calls itself at line 47 (`_without_keys`) with a piece of `value` (and at line 49) — and nowhere in `_without_keys` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_without_keys` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/gemini.py:117 — `has_additional_properties` is public and takes `schema: Any` from its caller, and it calls itself at line 117 (`has_additional_properties`) with a piece of `schema` (and at line 122) — and nowhere in `has_additional_properties` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `has_additional_properties` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/gemini.py:138 — `has_self_reference` is public and takes `schema: Dict` from its caller, and it calls itself at line 138 (`has_self_reference`) with a piece of `schema` (and at line 143, line 150) — and nowhere in `has_self_reference` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `has_self_reference` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/gemini.py:265 — `convert_schema` is public and takes `schema_dict: Dict[str, Any]` from its caller, and it calls itself at line 265 (`convert_schema`) with a piece of `schema_dict` (and at line 294, line 369, line 409) — and nowhere in `convert_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `convert_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/json_schema.py:63 — `inline_pydantic_schema` is public, takes a document from its caller (line 46) and hands it to `process_schema`, which calls itself at line 63 (`process_schema`) with a piece of `s` (and at line 80, line 85, line 88, line 92) — and nowhere in `process_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `process_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/json_schema.py:111 — `get_json_schema_for_arg` is public and takes `type_hint: Any` from its caller, and it calls itself at line 111 (`get_json_schema_for_arg`) with a piece of `type_hint` (and at line 130, line 134, line 135, line 141, line 164) — and nowhere in `get_json_schema_for_arg` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `get_json_schema_for_arg` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/media_offload.py:92 — `collect_opted_out_media_ids` is public and takes `run_response: Any` from its caller, and it calls itself at line 92 (`collect_opted_out_media_ids`) with a piece of `run_response` — and nowhere in `collect_opted_out_media_ids` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_opted_out_media_ids` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/media_offload.py:654 — `offload_workflow_media` is public and takes `run_response: Any` from its caller, and it calls itself at line 654 (`offload_workflow_media`) with a piece of `run_response` — and nowhere in `offload_workflow_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `offload_workflow_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/media_offload.py:691 — `aoffload_workflow_media` is public and takes `run_response: Any` from its caller, and it calls itself at line 691 (`aoffload_workflow_media`) with a piece of `run_response` — and nowhere in `aoffload_workflow_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `aoffload_workflow_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/media_offload.py:775 — `iter_run_media` is public and takes `run: Any` from its caller, and it calls itself at line 775 (`iter_run_media`) with a piece of `run` (and at line 782, line 785) — and nowhere in `iter_run_media` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `iter_run_media` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/merge_dict.py:18 — `merge_dictionaries` is public and takes `a: Dict[str, Any]` from its caller, and it calls itself at line 18 (`merge_dictionaries`) with a piece of `a` — and nowhere in `merge_dictionaries` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `merge_dictionaries` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/utils/models/openai_responses.py:143 — `sanitize_response_schema` is public and takes `schema: dict` from its caller, and it calls itself at line 143 (`sanitize_response_schema`) with a piece of `schema` (and at line 147) — and nowhere in `sanitize_response_schema` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `sanitize_response_schema` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/run/team.py:1002 — `from_dict` is public and takes `data: Dict[str, Any]` from its caller, and it calls itself at line 1002 (`self.from_dict`) with a piece of `data` — and nowhere in `from_dict` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/os/utils.py:2411 — `collect_mcp_tools_from_workflow_step` is public and takes `step: Any` from its caller, and it calls itself at line 2411 (`collect_mcp_tools_from_workflow_step`) with a piece of `step` — and nowhere in `collect_mcp_tools_from_workflow_step` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_mcp_tools_from_workflow_step` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/os/utils.py:2531 — `collect_components_from_team` is public and takes `team: Any` from its caller, and it calls itself at line 2531 (`collect_components_from_team`) with a piece of `team` — and nowhere in `collect_components_from_team` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_components_from_team` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/learn/utils.py:128 — `content_values_text` is public, takes a document from its caller (line 115) and hands it to `walk`, which calls itself at line 128 (`walk`) with a piece of `node` (and at line 131) — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap REDACTED:69 — `convert_any_metrics_in_data` is public and takes `data: Any` from its caller, and it calls itself at line 69 (`convert_any_metrics_in_data`) with a piece of `data` (and at line 75) — and nowhere in `convert_any_metrics_in_data` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `convert_any_metrics_in_data` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/db/dynamo/utils.py:108 — `deserialize_from_dynamodb_item` is public and takes `item: Dict[str, Any]` from its caller, and it calls itself at line 108 (`deserialize_from_dynamodb_item`) with a piece of `item` — and nowhere in `deserialize_from_dynamodb_item` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `deserialize_from_dynamodb_item` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap libs/agno/agno/agent/_messages.py:901 — `get_system_message` is public, takes a document from its caller (line 917) and hands it to `_learning_message_text`, which calls itself at line 901 (`_learning_message_text`) with a piece of `input` (and at line 903, line 911) — and nowhere in `_learning_message_text` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_learning_message_text` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap cookbook/05_agent_os/05_human_in_the_loop/team_approval.py:110 — `find_approval_id` is public and takes `value: Any` from its caller, and it calls itself at line 110 (`find_approval_id`) with a piece of `value` (and at line 115) — and nowhere in `find_approval_id` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `find_approval_id` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×22
  • Duplicated block (28 lines × 2) cookbook/07_knowledge/09_archive/custom_retriever/retriever.py:34 — cookbook/07_knowledge/09_archive/custom_retriever/retriever.py:34-61 | cookbook/07_knowledge/09_archive/custom_retriever/team_retriever.py:34-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (28 lines × 2) libs/agno/agno/agent/_managers.py:46 — libs/agno/agno/agent/_managers.py:46-73 | libs/agno/agno/agent/_managers.py:101-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_managers.py:46` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1014 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1014-1041 | libs/agno/agno/db/json/json_db.py:1081-1108 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1913 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1913-1940 | libs/agno/agno/db/json/json_db.py:2008-2035 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (28 lines × 2) REDACTED:307 — REDACTED:307-334 | REDACTED:814-841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1837 — libs/agno/agno/db/mysql/async_mysql.py:1837-1864 | libs/agno/agno/db/postgres/async_postgres.py:2233-2260 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2416 — libs/agno/agno/db/mysql/async_mysql.py:2416-2443 | libs/agno/agno/db/postgres/async_postgres.py:2761-2788 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/mysql/mysql.py:3000 — libs/agno/agno/db/mysql/mysql.py:3000-3027 | libs/agno/agno/db/singlestore/singlestore.py:2940-2967 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/mysql/utils.py:133 — libs/agno/agno/db/mysql/utils.py:133-160 | libs/agno/agno/db/mysql/utils.py:184-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `session` to `Session` in one and `AsyncSession` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4524 — libs/agno/agno/db/postgres/async_postgres.py:4524-4551 | REDACTED:4597-4624 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4618 — libs/agno/agno/db/postgres/async_postgres.py:4618-4645 | REDACTED:4691-4718 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/postgres/postgres.py:5421 — libs/agno/agno/db/postgres/postgres.py:5421-5448 | REDACTED:5260-5287 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/redis/redis.py:1275 — libs/agno/agno/db/redis/redis.py:1275-1302 | libs/agno/agno/db/valkey/valkey.py:1575-1602 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/db/redis/redis.py:1795 — libs/agno/agno/db/redis/redis.py:1795-1822 | libs/agno/agno/db/valkey/valkey.py:2225-2252 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/os/utils.py:1749 — libs/agno/agno/os/utils.py:1749-1776 | libs/agno/agno/os/utils.py:1806-1833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/os/utils.py:1891 — libs/agno/agno/os/utils.py:1891-1918 | libs/agno/agno/os/utils.py:1950-1977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 2) libs/agno/agno/run/agent.py:803 — libs/agno/agno/run/agent.py:803-830 | libs/agno/agno/run/team.py:886-913 — before extracting anything, compare `libs/agno/agno/run/agent.py` and `libs/agno/agno/run/team.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 181 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/run/team.py:884` calls `to_dict`, `isinstance` and `libs/agno/agno/run/agent.py:801` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (28 lines × 2) libs/agno/agno/team/_run.py:2203 — libs/agno/agno/team/_run.py:2203-2230 | libs/agno/agno/team/_run.py:3180-3207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (28 lines × 2) libs/agno/agno/tools/duckdb.py:306 — libs/agno/agno/tools/duckdb.py:306-333 | libs/agno/agno/tools/duckdb.py:359-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (28 lines × 2) REDACTED:1295 — REDACTED:1295-1322 | REDACTED:1209-1236 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1323` calls `_require_preparable` and `REDACTED:1237` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (28 lines × 2) REDACTED:1421 — REDACTED:1421-1448 | REDACTED:1333-1360 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1449` calls `_mark_unretrievable` and `REDACTED:1361` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (28 lines × 2) REDACTED:293 — REDACTED:293-320 | REDACTED:418-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:448` calls `_upsert_vectors` and `REDACTED:322` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×22
  • Duplicated block (9 lines × 4) cookbook/91_tools/mcp/pipedream_auth.py:50 — cookbook/91_tools/mcp/pipedream_auth.py:50-58 | cookbook/91_tools/mcp/pipedream_google_calendar.py:32-40 | cookbook/91_tools/mcp/pipedream_linkedin.py:32-40 | cookbook/91_tools/mcp/pipedream_slack.py:33-41 — before extracting anything, compare `cookbook/91_tools/mcp/pipedream_google_calendar.py` and `cookbook/91_tools/mcp/pipedream_linkedin.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/91_tools/mcp/pipedream_auth.py:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/91_tools/mcp/pipedream_slack.py:50` calls `run`, `run_agent` and `cookbook/91_tools/mcp/pipedream_google_calendar.py:48` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) libs/agno/agno/agent/_messages.py:1587 — libs/agno/agno/agent/_messages.py:1587-1595 | libs/agno/agno/agent/_messages.py:1684-1692 | libs/agno/agno/agent/_messages.py:1757-1765 | libs/agno/agno/agent/_messages.py:1854-1862 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) libs/agno/agno/agent/_run.py:166 — libs/agno/agno/agent/_run.py:166-174 | libs/agno/agno/agent/_run.py:211-219 | libs/agno/agno/utils/callables.py:80-88 | libs/agno/agno/utils/callables.py:114-122 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 4) libs/agno/agno/agent/remote.py:393 — libs/agno/agno/agent/remote.py:393-401 | libs/agno/agno/agent/remote.py:436-444 | libs/agno/agno/team/remote.py:385-393 | libs/agno/agno/team/remote.py:428-436 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/remote.py:393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) REDACTED:289 — REDACTED:289-297 | REDACTED:421-429 | REDACTED:614-622 | REDACTED:744-752 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) REDACTED:251 — REDACTED:251-259 | REDACTED:350-358 | REDACTED:584-592 | REDACTED:671-679 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:845 — libs/agno/agno/db/postgres/async_postgres.py:845-853 | libs/agno/agno/db/postgres/postgres.py:1002-1010 | REDACTED:798-806 | REDACTED:1028-1036 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:807` calls `execute` and `REDACTED:1037` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4531 — libs/agno/agno/db/postgres/async_postgres.py:4531-4539 | libs/agno/agno/db/postgres/async_postgres.py:5857-5865 | REDACTED:4604-4612 | REDACTED:5024-5032 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6698 — libs/agno/agno/db/postgres/async_postgres.py:6698-6706 | libs/agno/agno/db/postgres/postgres.py:9443-9451 | REDACTED:5867-5875 | REDACTED:8372-8380 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6829 — libs/agno/agno/db/postgres/async_postgres.py:6829-6837 | libs/agno/agno/db/postgres/postgres.py:9568-9576 | REDACTED:5998-6006 | REDACTED:8497-8505 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) libs/agno/agno/db/redis/redis.py:2920 — libs/agno/agno/db/redis/redis.py:2920-2928 | libs/agno/agno/db/redis/redis.py:2948-2956 | libs/agno/agno/db/redis/redis.py:3048-3056 | libs/agno/agno/db/redis/redis.py:3135-3143 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) libs/agno/agno/knowledge/loaders/gcs.py:140 — libs/agno/agno/knowledge/loaders/gcs.py:140-148 | libs/agno/agno/knowledge/loaders/gcs.py:227-235 | libs/agno/agno/knowledge/loaders/s3.py:124-132 | libs/agno/agno/knowledge/loaders/s3.py:220-228 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 4) REDACTED:239 — REDACTED:239-247 | REDACTED:287-295 | REDACTED:337-345 | REDACTED:390-398 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:239` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) libs/agno/agno/os/interfaces/a2a/utils.py:414 — libs/agno/agno/os/interfaces/a2a/utils.py:414-422 | libs/agno/agno/os/interfaces/a2a/utils.py:448-456 | libs/agno/agno/os/interfaces/a2a/utils.py:460-468 | libs/agno/agno/os/interfaces/a2a/utils.py:471-479 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) libs/agno/agno/tools/google/gmail.py:419 — libs/agno/agno/tools/google/gmail.py:419-427 | libs/agno/agno/tools/google/gmail.py:485-493 | libs/agno/agno/tools/google/gmail.py:538-546 | libs/agno/agno/tools/google/gmail.py:618-626 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) libs/agno/agno/utils/print_response/agent.py:204 — libs/agno/agno/utils/print_response/agent.py:204-212 | libs/agno/agno/utils/print_response/agent.py:411-419 | libs/agno/agno/utils/print_response/agent.py:649-657 | libs/agno/agno/utils/print_response/agent.py:769-777 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/utils/print_response/agent.py:202` calls `update`, `Group` and `libs/agno/agno/utils/print_response/agent.py:647` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) REDACTED:960 — REDACTED:960-968 | REDACTED:1034-1042 | REDACTED:1131-1139 | REDACTED:1232-1240 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:960` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:972` calls `rerank` and `REDACTED:1044` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) REDACTED:464 — REDACTED:464-472 | REDACTED:538-546 | REDACTED:659-667 | REDACTED:899-907 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) libs/agno/agno/workflow/condition.py:332 — libs/agno/agno/workflow/condition.py:332-340 | libs/agno/agno/workflow/loop.py:383-391 | libs/agno/agno/workflow/router.py:428-436 | libs/agno/agno/workflow/steps.py:206-214 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
  • Duplicated block (9 lines × 4) libs/agno/agno/workflow/workflow.py:2977 — libs/agno/agno/workflow/workflow.py:2977-2985 | libs/agno/agno/workflow/workflow.py:3367-3375 | libs/agno/agno/workflow/workflow.py:3982-3990 | libs/agno/agno/workflow/workflow.py:4396-4404 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:2977` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) libs/agno/agno/workflow/workflow.py:5816 — libs/agno/agno/workflow/workflow.py:5816-5824 | libs/agno/agno/workflow/workflow.py:6007-6015 | libs/agno/agno/workflow/workflow.py:6222-6230 | libs/agno/agno/workflow/workflow.py:6423-6431 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5816` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:6000` calls `log_debug` and `libs/agno/agno/workflow/workflow.py:6416` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) libs/agno/agno/workflow/workflow.py:7193 — libs/agno/agno/workflow/workflow.py:7193-7201 | libs/agno/agno/workflow/workflow.py:8099-8107 | libs/agno/agno/workflow/workflow.py:9252-9260 | libs/agno/agno/workflow/workflow.py:9857-9867 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×22
  • Duplicated block (5 lines × 4) libs/agno/agno/db/firestore/firestore.py:434 — libs/agno/agno/db/firestore/firestore.py:434-438 | libs/agno/agno/db/firestore/firestore.py:797-801 | libs/agno/agno/db/firestore/firestore.py:1324-1328 | libs/agno/agno/db/firestore/firestore.py:2079-2083 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/firestore/firestore.py:1331` calls `where`, `FieldFilter` and `libs/agno/agno/db/firestore/firestore.py:440` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) REDACTED:1913 — REDACTED:1913-1917 | REDACTED:2006-2010 | REDACTED:2098-2102 | REDACTED:2164-2168 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1912` calls `_get_all_records` and `REDACTED:2096` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:236 — libs/agno/agno/db/mysql/async_mysql.py:236-240 | libs/agno/agno/db/mysql/mysql.py:231-235 | libs/agno/agno/db/postgres/async_postgres.py:406-410 | libs/agno/agno/db/singlestore/singlestore.py:302-306 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/mysql/mysql.py:877 — libs/agno/agno/db/mysql/mysql.py:877-881 | libs/agno/agno/db/postgres/postgres.py:1425-1430 | libs/agno/agno/db/singlestore/singlestore.py:931-935 | REDACTED:1407-1411 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/postgres.py:1424` calls `_collect_sandbox_leftovers` and `libs/agno/agno/db/mysql/mysql.py:876` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1901 — libs/agno/agno/db/postgres/async_postgres.py:1901-1905 | libs/agno/agno/db/postgres/postgres.py:2132-2136 | REDACTED:1779-1783 | REDACTED:2036-2040 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:1901` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6093 — libs/agno/agno/db/postgres/async_postgres.py:6093-6097 | libs/agno/agno/db/postgres/postgres.py:8853-8857 | REDACTED:5262-5266 | REDACTED:7784-7788 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6463 — libs/agno/agno/db/postgres/async_postgres.py:6463-6467 | libs/agno/agno/db/postgres/async_postgres.py:6697-6701 | REDACTED:5632-5636 | REDACTED:5866-5870 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:6704` calls `where` and `libs/agno/agno/db/postgres/async_postgres.py:6469` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6483 — libs/agno/agno/db/postgres/async_postgres.py:6483-6487 | libs/agno/agno/db/postgres/postgres.py:9234-9238 | REDACTED:5652-5656 | REDACTED:8163-8167 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6482 — libs/agno/agno/db/postgres/async_postgres.py:6482-6486 | libs/agno/agno/db/postgres/async_postgres.py:6725-6729 | REDACTED:5651-5655 | REDACTED:5894-5898 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:6724` calls `validate_project_fields` and `libs/agno/agno/db/postgres/async_postgres.py:6480` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6496 — libs/agno/agno/db/postgres/async_postgres.py:6496-6500 | libs/agno/agno/db/postgres/postgres.py:9247-9251 | REDACTED:5665-5669 | REDACTED:8176-8180 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7064 — libs/agno/agno/db/postgres/async_postgres.py:7064-7068 | libs/agno/agno/db/postgres/async_postgres.py:7103-7110 | REDACTED:6233-6237 | REDACTED:6272-6279 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:7064` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7154 — libs/agno/agno/db/postgres/async_postgres.py:7154-7158 | libs/agno/agno/db/postgres/postgres.py:9881-9885 | REDACTED:6323-6327 | REDACTED:8810-8814 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7185 — libs/agno/agno/db/postgres/async_postgres.py:7185-7189 | libs/agno/agno/db/postgres/postgres.py:9912-9916 | REDACTED:6354-6358 | REDACTED:8841-8845 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/postgres.py:9216 — libs/agno/agno/db/postgres/postgres.py:9216-9220 | libs/agno/agno/db/postgres/postgres.py:9442-9446 | REDACTED:8145-8149 | REDACTED:8371-8375 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:9449` calls `where` and `libs/agno/agno/db/postgres/postgres.py:9222` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) libs/agno/agno/db/postgres/postgres.py:9233 — libs/agno/agno/db/postgres/postgres.py:9233-9237 | libs/agno/agno/db/postgres/postgres.py:9470-9474 | REDACTED:8162-8166 | REDACTED:8399-8403 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 4) libs/agno/agno/knowledge/chunking/document.py:43 — libs/agno/agno/knowledge/chunking/document.py:43-47 | libs/agno/agno/knowledge/chunking/document.py:68-76 | libs/agno/agno/knowledge/chunking/document.py:101-105 | libs/agno/agno/knowledge/chunking/markdown.py:294-298 — before extracting anything, compare `libs/agno/agno/knowledge/chunking/document.py` and `libs/agno/agno/knowledge/chunking/markdown.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/chunking/document.py:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 4) libs/agno/agno/models/aws/bedrock.py:590 — libs/agno/agno/models/aws/bedrock.py:590-594 | libs/agno/agno/models/aws/bedrock.py:640-644 | libs/agno/agno/models/aws/bedrock.py:689-693 | libs/agno/agno/models/aws/bedrock.py:739-743 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) libs/agno/agno/models/huggingface/huggingface.py:262 — libs/agno/agno/models/huggingface/huggingface.py:262-266 | libs/agno/agno/models/huggingface/huggingface.py:293-297 | libs/agno/agno/models/huggingface/huggingface.py:329-333 | libs/agno/agno/models/huggingface/huggingface.py:364-368 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) libs/agno/agno/models/mistral/mistral.py:235 — libs/agno/agno/models/mistral/mistral.py:235-239 | libs/agno/agno/models/mistral/mistral.py:269-273 | libs/agno/agno/models/mistral/mistral.py:317-321 | libs/agno/agno/models/mistral/mistral.py:350-354 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 4) REDACTED:706 — REDACTED:706-710 | REDACTED:769-773 | REDACTED:1012-1016 | REDACTED:1366-1370 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:706` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) libs/agno/agno/workflow/condition.py:312 — libs/agno/agno/workflow/condition.py:312-316 | libs/agno/agno/workflow/loop.py:368-372 | libs/agno/agno/workflow/parallel.py:173-177 | libs/agno/agno/workflow/steps.py:191-195 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:312` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) libs/agno/agno/workflow/loop.py:574 — libs/agno/agno/workflow/loop.py:574-578 | libs/agno/agno/workflow/loop.py:818-822 | libs/agno/agno/workflow/loop.py:971-975 | libs/agno/agno/workflow/loop.py:1215-1219 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×20
  • Duplicated block (9 lines × 3) libs/agno/agno/agent/_messages.py:1055 — libs/agno/agno/agent/_messages.py:1055-1063 | libs/agno/agno/agent/_messages.py:1352-1360 | libs/agno/agno/team/_messages.py:334-342 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 3) libs/agno/agno/agent/_response.py:147 — libs/agno/agno/agent/_response.py:147-155 | libs/agno/agno/team/_response.py:561-569 | libs/agno/agno/utils/reasoning.py:94-102 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:694 — libs/agno/agno/db/gcs_json/gcs_json_db.py:694-702 | libs/agno/agno/db/in_memory/in_memory_db.py:365-373 | libs/agno/agno/db/json/json_db.py:746-754 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/gcs_json/gcs_json_db.py:693` calls `_read_json_file` and `libs/agno/agno/db/in_memory/in_memory_db.py:360` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2294 — libs/agno/agno/db/mysql/async_mysql.py:2294-2302 | libs/agno/agno/db/postgres/async_postgres.py:2640-2648 | REDACTED:2837-2845 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 3) libs/agno/agno/os/routers/company/products.py:31 — libs/agno/agno/os/routers/company/products.py:31-39 | libs/agno/agno/os/routers/company/projects.py:42-50 | libs/agno/agno/os/routers/company/tasks.py:38-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/company/products.py:31` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) libs/agno/agno/tools/function.py:2494 — libs/agno/agno/tools/function.py:2494-2502 | libs/agno/agno/tools/function.py:2805-2813 | libs/agno/agno/tools/function.py:2820-2828 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/tools/function.py:2814` calls `iscoroutinefunction`, `isasyncgenfunction` and `libs/agno/agno/tools/function.py:2503` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) libs/agno/agno/tools/studio.py:3290 — libs/agno/agno/tools/studio.py:3290-3298 | libs/agno/agno/tools/studio.py:3407-3415 | libs/agno/agno/tools/studio.py:3493-3501 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) libs/agno/agno/utils/callables.py:221 — libs/agno/agno/utils/callables.py:221-229 | libs/agno/agno/utils/callables.py:302-310 | libs/agno/agno/utils/callables.py:381-389 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) libs/agno/agno/utils/callables.py:259 — libs/agno/agno/utils/callables.py:259-267 | libs/agno/agno/utils/callables.py:340-348 | libs/agno/agno/utils/callables.py:418-426 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) libs/agno/agno/vectordb/valkey/valkeydb.py:502 — libs/agno/agno/vectordb/valkey/valkeydb.py:502-510 | libs/agno/agno/vectordb/valkey/valkeydb.py:521-529 | libs/agno/agno/vectordb/valkey/valkeydb.py:544-552 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) libs/agno/agno/workflow/condition.py:166 — libs/agno/agno/workflow/condition.py:166-174 | libs/agno/agno/workflow/router.py:185-193 | libs/agno/agno/workflow/steps.py:104-112 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) libs/agno/agno/workflow/condition.py:220 — libs/agno/agno/workflow/condition.py:220-228 | libs/agno/agno/workflow/loop.py:224-232 | libs/agno/agno/workflow/router.py:262-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) libs/agno/agno/workflow/loop.py:228 — libs/agno/agno/workflow/loop.py:228-236 | libs/agno/agno/workflow/parallel.py:130-138 | libs/agno/agno/workflow/router.py:266-274 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) libs/agno_infra/agno/aws/resource/ecs/service.py:410 — libs/agno_infra/agno/aws/resource/ecs/service.py:410-418 | libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py:173-181 | libs/agno_infra/agno/aws/resource/rds/db_subnet_group.py:178-186 — before extracting anything, compare `libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py` and `libs/agno_infra/agno/aws/resource/rds/db_subnet_group.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resource/ecs/service.py:410` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno_infra/agno/aws/resource/ecs/service.py:419` calls `error` and `libs/agno_infra/agno/aws/resource/elasticache/subnet_group.py:182` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) libs/agno_infra/agno/docker/resources.py:69 — libs/agno_infra/agno/docker/resources.py:69-77 | libs/agno_infra/agno/docker/resources.py:228-236 | libs/agno_infra/agno/docker/resources.py:393-401 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) libs/agno_infra/agno/docker/resources.py:144 — libs/agno_infra/agno/docker/resources.py:144-152 | libs/agno_infra/agno/docker/resources.py:309-317 | libs/agno_infra/agno/docker/resources.py:465-473 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) REDACTED:2849 — REDACTED:2849-2857 | REDACTED:2460-2468 | REDACTED:1262-1270 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 3) libs/agno/agno/knowledge/embedder/cohere.py:35 — libs/agno/agno/knowledge/embedder/cohere.py:35-43 | libs/agno/agno/knowledge/embedder/huggingface.py:32-40 | libs/agno/agno/knowledge/embedder/huggingface.py:44-52 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) libs/agno/agno/workflow/condition.py:460 — libs/agno/agno/workflow/condition.py:460-468 | libs/agno/agno/workflow/router.py:517-525 | libs/agno/agno/workflow/router.py:611-619 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/condition.py:470` calls `_has_else_steps` and `libs/agno/agno/workflow/router.py:621` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) libs/agno/agno/metrics.py:198 — libs/agno/agno/metrics.py:198-206 | libs/agno/agno/metrics.py:338-346 | libs/agno/agno/metrics.py:607-615 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `other` to `"MessageMetrics"` in one and `"RunMetrics"` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×19
  • Duplicated block (11 lines × 4) libs/agno/agno/agent/_default_tools.py:215 — libs/agno/agno/agent/_default_tools.py:215-225 | libs/agno/agno/agent/_default_tools.py:244-254 | libs/agno/agno/team/_default_tools.py:1717-1727 | libs/agno/agno/team/_default_tools.py:1744-1754 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_default_tools.py:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/agent/_managers.py:34 — libs/agno/agno/agent/_managers.py:34-44 | libs/agno/agno/agent/_managers.py:89-99 | libs/agno/agno/team/_managers.py:33-43 | libs/agno/agno/team/_managers.py:58-68 — `libs/agno/agno/agent/_managers.py` and `libs/agno/agno/team/_managers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 100 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 4) libs/agno/agno/agent/_run.py:1463 — libs/agno/agno/agent/_run.py:1463-1473 | libs/agno/agno/agent/_run.py:2855-2865 | libs/agno/agno/team/_run.py:2067-2077 | libs/agno/agno/team/_run.py:4263-4273 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1463` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/mongo/async_mongo.py:1246 — libs/agno/agno/db/mongo/async_mongo.py:1246-1256 | libs/agno/agno/db/mongo/mongo.py:1054-1065 | libs/agno/agno/db/redis/redis.py:952-964 | libs/agno/agno/db/valkey/valkey.py:1086-1098 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:1368 — libs/agno/agno/db/mysql/async_mysql.py:1368-1378 | libs/agno/agno/db/mysql/mysql.py:1352-1362 | libs/agno/agno/db/postgres/postgres.py:2188-2198 | libs/agno/agno/db/singlestore/singlestore.py:1404-1414 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:1381` calls `async_session_factory`, `begin` and `libs/agno/agno/db/postgres/postgres.py:2201` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:1839 — libs/agno/agno/db/mysql/async_mysql.py:1839-1849 | libs/agno/agno/db/mysql/async_mysql.py:2381-2391 | libs/agno/agno/db/postgres/async_postgres.py:2235-2245 | libs/agno/agno/db/postgres/async_postgres.py:2726-2736 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:2693 — libs/agno/agno/db/mysql/async_mysql.py:2693-2703 | libs/agno/agno/db/postgres/async_postgres.py:3065-3075 | REDACTED:3214-3224 | REDACTED:3467-3477 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1225 — libs/agno/agno/db/postgres/async_postgres.py:1225-1235 | libs/agno/agno/db/postgres/postgres.py:1386-1396 | REDACTED:1183-1193 | REDACTED:1372-1382 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3246 — libs/agno/agno/db/postgres/async_postgres.py:3246-3256 | libs/agno/agno/db/postgres/postgres.py:3790-3800 | REDACTED:3400-3410 | REDACTED:3596-3606 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3246` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:5876 — libs/agno/agno/db/postgres/async_postgres.py:5876-5886 | libs/agno/agno/db/postgres/async_postgres.py:6133-6143 | REDACTED:5043-5053 | REDACTED:5304-5314 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7014 — libs/agno/agno/db/postgres/async_postgres.py:7014-7024 | libs/agno/agno/db/postgres/postgres.py:9745-9755 | REDACTED:6183-6193 | REDACTED:8674-8684 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 4) libs/agno/agno/db/postgres/postgres.py:5259 — libs/agno/agno/db/postgres/postgres.py:5259-5269 | libs/agno/agno/db/postgres/postgres.py:5736-5746 | REDACTED:5099-5109 | REDACTED:5527-5537 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5259` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) libs/agno/agno/knowledge/loaders/gcs.py:235 — libs/agno/agno/knowledge/loaders/gcs.py:235-245 | libs/agno/agno/knowledge/loaders/github.py:607-617 | libs/agno/agno/knowledge/loaders/s3.py:228-238 | libs/agno/agno/knowledge/loaders/sharepoint.py:419-429 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/loaders/gcs.py:235` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/learn/stores/session_context.py:969 — libs/agno/agno/learn/stores/session_context.py:969-979 | libs/agno/agno/learn/stores/session_context.py:1018-1028 | libs/agno/agno/learn/stores/session_context.py:1110-1120 | libs/agno/agno/learn/stores/session_context.py:1159-1169 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/session_context.py:969` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/models/azure/ai_foundry.py:228 — libs/agno/agno/models/azure/ai_foundry.py:228-238 | libs/agno/agno/models/azure/ai_foundry.py:266-276 | libs/agno/agno/models/azure/ai_foundry.py:303-313 | libs/agno/agno/models/azure/ai_foundry.py:341-351 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 4) libs/agno/agno/utils/callables.py:236 — libs/agno/agno/utils/callables.py:236-246 | libs/agno/agno/utils/callables.py:274-284 | libs/agno/agno/utils/callables.py:396-406 | libs/agno/agno/utils/callables.py:433-443 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 4) REDACTED:1470 — REDACTED:1470-1480 | REDACTED:1536-1546 | REDACTED:1576-1586 | REDACTED:1611-1621 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1470` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno/agno/workflow/workflow.py:6733 — libs/agno/agno/workflow/workflow.py:6733-6743 | libs/agno/agno/workflow/workflow.py:6788-6798 | libs/agno/agno/workflow/workflow.py:8765-8775 | libs/agno/agno/workflow/workflow.py:8818-8828 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:288 — libs/agno_infra/agno/aws/resource/rds/db_cluster.py:288-298 | libs/agno_infra/agno/aws/resource/rds/db_cluster.py:302-312 | libs/agno_infra/agno/aws/resource/rds/db_instance.py:210-220 | libs/agno_infra/agno/aws/resource/rds/db_instance.py:224-234 — before extracting anything, compare `libs/agno_infra/agno/aws/resource/rds/db_cluster.py` and `libs/agno_infra/agno/aws/resource/rds/db_instance.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×19
  • Duplicated block (7 lines × 4) cookbook/05_agent_os/21_factories/01_basic.py:83 — cookbook/05_agent_os/21_factories/01_basic.py:83-91 | cookbook/05_agent_os/21_factories/02_with_input_schema.py:75-83 | cookbook/05_agent_os/21_factories/05_team_factory.py:93-99 | cookbook/05_agent_os/21_factories/06_workflow_factory.py:97-105 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/21_factories/01_basic.py:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/mysql/mysql.py:2104 — libs/agno/agno/db/mysql/mysql.py:2104-2110 | libs/agno/agno/db/postgres/postgres.py:2993-2999 | libs/agno/agno/db/singlestore/singlestore.py:2129-2135 | REDACTED:2914-2920 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1482 — libs/agno/agno/db/postgres/async_postgres.py:1482-1488 | libs/agno/agno/db/postgres/postgres.py:1651-1657 | REDACTED:1408-1414 | REDACTED:1605-1611 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3558 — libs/agno/agno/db/postgres/async_postgres.py:3558-3564 | libs/agno/agno/db/postgres/postgres.py:4100-4106 | REDACTED:3708-3714 | REDACTED:3907-3913 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3558` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3704` calls `log_debug` and `libs/agno/agno/db/postgres/async_postgres.py:3554` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4005 — libs/agno/agno/db/postgres/async_postgres.py:4005-4011 | libs/agno/agno/db/postgres/postgres.py:6736-6742 | REDACTED:4138-4144 | REDACTED:6507-6513 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4451 — libs/agno/agno/db/postgres/async_postgres.py:4451-4457 | libs/agno/agno/db/postgres/postgres.py:7175-7181 | REDACTED:4524-4530 | REDACTED:6943-6949 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4747 — libs/agno/agno/db/postgres/async_postgres.py:4747-4753 | libs/agno/agno/db/postgres/async_postgres.py:6118-6124 | REDACTED:4837-4843 | REDACTED:5289-5295 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6411 — libs/agno/agno/db/postgres/async_postgres.py:6411-6417 | libs/agno/agno/db/postgres/postgres.py:9164-9170 | REDACTED:5580-5586 | REDACTED:8093-8099 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6464 — libs/agno/agno/db/postgres/async_postgres.py:6464-6470 | libs/agno/agno/db/postgres/postgres.py:9217-9223 | REDACTED:5633-5639 | REDACTED:8146-8152 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6574 — libs/agno/agno/db/postgres/async_postgres.py:6574-6580 | libs/agno/agno/db/postgres/postgres.py:9321-9327 | REDACTED:5743-5749 | REDACTED:8250-8256 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/os/routers/agents/router.py:2363 — libs/agno/agno/os/routers/agents/router.py:2363-2369 | libs/agno/agno/os/routers/agents/router.py:2428-2434 | libs/agno/agno/os/routers/teams/router.py:2246-2252 | libs/agno/agno/os/routers/teams/router.py:2311-2317 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 4) libs/agno/agno/team/_run.py:5403 — libs/agno/agno/team/_run.py:5403-5410 | libs/agno/agno/team/_run.py:5463-5470 | libs/agno/agno/team/_run.py:5537-5543 | libs/agno/agno/team/_run.py:5617-5624 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:5403` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) libs/agno/agno/team/_run.py:6423 — libs/agno/agno/team/_run.py:6423-6430 | libs/agno/agno/team/_run.py:6505-6511 | libs/agno/agno/team/_run.py:6608-6614 | libs/agno/agno/team/_run.py:6705-6711 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 4) libs/agno/agno/tools/anakin.py:133 — libs/agno/agno/tools/anakin.py:133-139 | libs/agno/agno/tools/anakin.py:178-184 | libs/agno/agno/tools/anakin.py:226-232 | libs/agno/agno/tools/anakin.py:249-255 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/tools/serper.py:132 — libs/agno/agno/tools/serper.py:132-138 | libs/agno/agno/tools/serper.py:171-177 | libs/agno/agno/tools/serper.py:210-216 | libs/agno/agno/tools/serper.py:250-256 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/workflow/condition.py:219 — libs/agno/agno/workflow/condition.py:219-225 | libs/agno/agno/workflow/loop.py:223-229 | libs/agno/agno/workflow/router.py:261-267 | libs/agno/agno/workflow/steps.py:134-140 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:219` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/workflow/condition.py:223 — libs/agno/agno/workflow/condition.py:223-229 | libs/agno/agno/workflow/loop.py:227-233 | libs/agno/agno/workflow/parallel.py:129-135 | libs/agno/agno/workflow/router.py:265-271 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/workflow/loop.py:231 — libs/agno/agno/workflow/loop.py:231-237 | libs/agno/agno/workflow/parallel.py:133-139 | libs/agno/agno/workflow/router.py:269-275 | libs/agno/agno/workflow/steps.py:142-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) libs/agno/agno/workflow/router.py:802 — libs/agno/agno/workflow/router.py:802-808 | libs/agno/agno/workflow/router.py:929-935 | libs/agno/agno/workflow/router.py:1141-1147 | libs/agno/agno/workflow/router.py:1270-1276 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×18
  • Duplicated block (31 lines × 2) cookbook/02_agents/14_advanced/background_execution_metrics.py:59 — cookbook/02_agents/14_advanced/background_execution_metrics.py:59-89 | cookbook/03_teams/14_run_control/background_execution_metrics.py:68-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/14_advanced/background_execution_metrics.py:59` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/agent/_run.py:3392 — libs/agno/agno/agent/_run.py:3392-3422 | libs/agno/agno/team/_run.py:7466-7496 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (31 lines × 2) REDACTED:424 — REDACTED:424-454 | REDACTED:747-777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:424` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1565 — libs/agno/agno/db/mongo/async_mongo.py:1565-1595 | libs/agno/agno/db/mongo/async_mongo.py:2365-2397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1372 — libs/agno/agno/db/mysql/async_mysql.py:1372-1402 | REDACTED:1861-1891 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1861` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1295 — libs/agno/agno/db/postgres/async_postgres.py:1295-1325 | REDACTED:1250-1280 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1326` calls `_collect_sandbox_leftovers` and `REDACTED:1282` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (31 lines × 2) libs/agno/agno/db/redis/redis.py:517 — libs/agno/agno/db/redis/redis.py:517-547 | libs/agno/agno/db/valkey/valkey.py:603-633 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:517` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31 lines × 2) libs/agno/agno/db/redis/redis.py:602 — libs/agno/agno/db/redis/redis.py:602-632 | libs/agno/agno/db/valkey/valkey.py:688-718 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/knowledge/loaders/sharepoint.py:270 — libs/agno/agno/knowledge/loaders/sharepoint.py:270-300 | libs/agno/agno/knowledge/loaders/sharepoint.py:389-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/loaders/sharepoint.py:270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/knowledge/reranker/infinity.py:93 — libs/agno/agno/knowledge/reranker/infinity.py:93-123 | libs/agno/agno/knowledge/reranker/infinity.py:165-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) libs/agno/agno/team/_run.py:1145 — libs/agno/agno/team/_run.py:1145-1175 | libs/agno/agno/team/_run.py:1507-1537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31 lines × 2) libs/agno/agno/tools/company.py:1143 — libs/agno/agno/tools/company.py:1143-1173 | libs/agno/agno/tools/company.py:1343-1373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) libs/agno/agno/tools/memory.py:153 — libs/agno/agno/tools/memory.py:153-183 | libs/agno/agno/tools/memory.py:219-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/memory.py:153` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/tools/scheduler.py:847 — libs/agno/agno/tools/scheduler.py:847-877 | libs/agno/agno/tools/scheduler.py:1238-1268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/scheduler.py:847` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/utils/print_response/team.py:903 — libs/agno/agno/utils/print_response/team.py:903-933 | libs/agno/agno/utils/print_response/team.py:1852-1882 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) libs/agno/agno/workflow/condition.py:534 — libs/agno/agno/workflow/condition.py:534-564 | libs/agno/agno/workflow/condition.py:989-1019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:534` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31 lines × 2) libs/agno/agno/workflow/parallel.py:481 — libs/agno/agno/workflow/parallel.py:481-511 | libs/agno/agno/workflow/parallel.py:847-877 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (31 lines × 2) libs/agno/agno/workflow/step.py:1694 — libs/agno/agno/workflow/step.py:1694-1724 | libs/agno/agno/workflow/step.py:2421-2451 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1694` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/step.py:1725` calls `log_debug` and `libs/agno/agno/workflow/step.py:2454` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×18
  • Duplicated block (25 lines × 2) cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:74 — cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:74-98 | cookbook/frameworks/codex/codex_metrics_agentos.py:71-95 — `cookbook/frameworks/claude-agent-sdk/metrics_agentos.py` and `cookbook/frameworks/codex/codex_metrics_agentos.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) libs/agno/agno/agent/_cli.py:201 — libs/agno/agno/agent/_cli.py:201-225 | libs/agno/agno/team/_cli.py:225-249 — `libs/agno/agno/agent/_cli.py` and `libs/agno/agno/team/_cli.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_cli.py:201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) libs/agno/agno/agent/_run.py:2553 — libs/agno/agno/agent/_run.py:2553-2577 | libs/agno/agno/agent/_run.py:5665-5689 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) libs/agno/agno/agent/_run_options.py:105 — libs/agno/agno/agent/_run_options.py:105-129 | libs/agno/agno/team/_run_options.py:103-127 — `libs/agno/agno/agent/_run_options.py` and `libs/agno/agno/team/_run_options.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (25 lines × 2) libs/agno/agno/db/mongo/utils.py:269 — libs/agno/agno/db/mongo/utils.py:269-293 | libs/agno/agno/db/mongo/utils.py:316-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `collection` to `Collection` in one and `"AsyncMongoCollectionType"` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (25 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5903 — libs/agno/agno/db/postgres/async_postgres.py:5903-5927 | REDACTED:5070-5094 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) libs/agno/agno/knowledge/reranker/infinity.py:63 — libs/agno/agno/knowledge/reranker/infinity.py:63-87 | libs/agno/agno/knowledge/reranker/infinity.py:135-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) libs/agno/agno/os/app.py:1805 — libs/agno/agno/os/app.py:1805-1829 | libs/agno/agno/os/app.py:1859-1883 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) libs/agno/agno/os/routers/agents/router.py:1222 — libs/agno/agno/os/routers/agents/router.py:1222-1246 | libs/agno/agno/os/routers/teams/router.py:1117-1141 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) libs/agno/agno/os/routers/agents/router.py:2559 — libs/agno/agno/os/routers/agents/router.py:2559-2583 | libs/agno/agno/os/routers/workflows/router.py:2765-2789 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/workflows/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 413 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2559` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) libs/agno/agno/team/_cli.py:104 — libs/agno/agno/team/_cli.py:104-128 | libs/agno/agno/team/_cli.py:210-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_cli.py:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) libs/agno/agno/team/_run.py:8062 — libs/agno/agno/team/_run.py:8062-8086 | libs/agno/agno/team/_run.py:8114-8138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) libs/agno/agno/team/_run.py:10086 — libs/agno/agno/team/_run.py:10086-10110 | libs/agno/agno/team/_run.py:10215-10239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25 lines × 2) libs/agno/agno/tools/openweather.py:111 — libs/agno/agno/tools/openweather.py:111-135 | libs/agno/agno/tools/openweather.py:198-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) REDACTED:1119 — REDACTED:1119-1143 | REDACTED:1233-1257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1259` calls `info` and `REDACTED:1145` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (25 lines × 2) REDACTED:2684 — REDACTED:2684-2708 | REDACTED:2339-2363 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) libs/agno/agno/workflow/workflow.py:5974 — libs/agno/agno/workflow/workflow.py:5974-5998 | libs/agno/agno/workflow/workflow.py:6392-6416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5974` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:6000` calls `log_debug` and `libs/agno/agno/workflow/workflow.py:6419` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (25 lines × 2) cookbook/04_workflows/02_conditional_execution/condition_with_list.py:93 — cookbook/04_workflows/02_conditional_execution/condition_with_list.py:93-117 | cookbook/04_workflows/04_parallel_execution/parallel_with_condition.py:90-127 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×18
  • Duplicated block (13 lines × 4) cookbook/02_agents/20_time_travel/01_continue_from.py:53 — cookbook/02_agents/20_time_travel/01_continue_from.py:53-65 | cookbook/02_agents/20_time_travel/01_continue_from.py:92-104 | cookbook/02_agents/20_time_travel/02_fork_run.py:58-70 | cookbook/02_agents/20_time_travel/02_fork_run.py:83-96 — before extracting anything, compare `cookbook/02_agents/20_time_travel/01_continue_from.py` and `cookbook/02_agents/20_time_travel/02_fork_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 4) libs/agno/agno/agent/_response.py:490 — libs/agno/agno/agent/_response.py:490-502 | libs/agno/agno/agent/_response.py:560-572 | libs/agno/agno/team/_response.py:282-294 | libs/agno/agno/team/_response.py:355-367 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:490` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 4) libs/agno/agno/agent/_run.py:509 — libs/agno/agno/agent/_run.py:509-521 | libs/agno/agno/agent/_run.py:918-930 | libs/agno/agno/agent/_run.py:1660-1672 | libs/agno/agno/agent/_run.py:2277-2289 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:509` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) libs/agno/agno/agent/_tools.py:1104 — libs/agno/agno/agent/_tools.py:1104-1116 | libs/agno/agno/agent/_tools.py:1157-1169 | libs/agno/agno/team/_run.py:5426-5438 | libs/agno/agno/team/_run.py:5494-5506 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_tools.py:1170` calls `run_tool` and `libs/agno/agno/agent/_tools.py:1117` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:1110 — libs/agno/agno/db/mysql/async_mysql.py:1110-1122 | libs/agno/agno/db/mysql/async_mysql.py:1750-1762 | libs/agno/agno/db/postgres/async_postgres.py:1693-1705 | libs/agno/agno/db/postgres/async_postgres.py:2146-2158 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:1352 — libs/agno/agno/db/mysql/async_mysql.py:1352-1365 | libs/agno/agno/db/mysql/mysql.py:1337-1349 | REDACTED:1838-1851 | REDACTED:2095-2108 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1352` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:1757 — libs/agno/agno/db/mysql/async_mysql.py:1757-1769 | libs/agno/agno/db/mysql/async_mysql.py:2686-2698 | libs/agno/agno/db/postgres/async_postgres.py:2153-2165 | libs/agno/agno/db/postgres/async_postgres.py:3058-3070 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/mysql/mysql.py:1104 — libs/agno/agno/db/mysql/mysql.py:1104-1116 | libs/agno/agno/db/postgres/postgres.py:1925-1937 | libs/agno/agno/db/singlestore/singlestore.py:1160-1172 | REDACTED:1879-1891 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1036 — libs/agno/agno/db/postgres/async_postgres.py:1036-1048 | libs/agno/agno/db/postgres/postgres.py:1185-1197 | REDACTED:987-999 | REDACTED:1172-1184 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6390 — libs/agno/agno/db/postgres/async_postgres.py:6390-6402 | libs/agno/agno/db/postgres/postgres.py:9143-9155 | REDACTED:5559-5571 | REDACTED:8072-8084 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 4) libs/agno/agno/db/postgres/postgres.py:7155 — libs/agno/agno/db/postgres/postgres.py:7155-7167 | libs/agno/agno/db/postgres/postgres.py:7506-7518 | REDACTED:6923-6935 | REDACTED:7291-7303 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 4) libs/agno/agno/learn/stores/learned_knowledge.py:1133 — libs/agno/agno/learn/stores/learned_knowledge.py:1133-1145 | libs/agno/agno/learn/stores/session_context.py:563-575 | libs/agno/agno/learn/stores/user_memory.py:782-794 | libs/agno/agno/learn/stores/user_profile.py:870-882 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
  • Duplicated block (13 lines × 4) libs/agno/agno/learn/stores/learned_knowledge.py:1185 — libs/agno/agno/learn/stores/learned_knowledge.py:1185-1197 | libs/agno/agno/learn/stores/session_context.py:633-645 | libs/agno/agno/learn/stores/user_memory.py:845-857 | libs/agno/agno/learn/stores/user_profile.py:930-942 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
  • Duplicated block (13 lines × 4) libs/agno/agno/team/_default_tools.py:721 — libs/agno/agno/team/_default_tools.py:721-733 | libs/agno/agno/team/_default_tools.py:782-794 | libs/agno/agno/team/_default_tools.py:1077-1089 | libs/agno/agno/team/_default_tools.py:1141-1153 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:721` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 4) libs/agno/agno/tools/brandfetch.py:91 — libs/agno/agno/tools/brandfetch.py:91-103 | libs/agno/agno/tools/brandfetch.py:127-139 | libs/agno/agno/tools/brandfetch.py:163-175 | libs/agno/agno/tools/brandfetch.py:199-211 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 4) libs/agno/agno/workflow/condition.py:703 — libs/agno/agno/workflow/condition.py:703-715 | libs/agno/agno/workflow/condition.py:751-763 | libs/agno/agno/workflow/condition.py:1156-1168 | libs/agno/agno/workflow/condition.py:1204-1216 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 4) libs/agno/agno/workflow/parallel.py:330 — libs/agno/agno/workflow/parallel.py:330-342 | libs/agno/agno/workflow/parallel.py:485-497 | libs/agno/agno/workflow/parallel.py:699-711 | libs/agno/agno/workflow/parallel.py:851-863 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 4) libs/agno/agno/os/routers/knowledge/knowledge.py:66 — libs/agno/agno/os/routers/knowledge/knowledge.py:66-79 | libs/agno/agno/os/routers/memory/memory.py:43-55 | libs/agno/agno/os/routers/metrics/metrics.py:37-49 | libs/agno/agno/os/routers/traces/traces.py:76-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×18
  • Duplicated block (12 lines × 3) cookbook/data_labeling/_26_scale_out/basic.py:98 — cookbook/data_labeling/_26_scale_out/basic.py:98-109 | cookbook/data_labeling/_26_scale_out/resumable.py:108-119 | cookbook/data_labeling/_26_scale_out/with_cost_tracking.py:108-119 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) libs/agno/agno/agent/_run.py:1189 — libs/agno/agno/agent/_run.py:1189-1200 | libs/agno/agno/agent/_run.py:2547-2560 | libs/agno/agno/agent/_run.py:4082-4093 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) libs/agno/agno/agent/_run.py:4031 — libs/agno/agno/agent/_run.py:4031-4043 | libs/agno/agno/team/_run.py:1752-1763 | libs/agno/agno/team/_run.py:8521-8532 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:4031` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:1249 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1249-1260 | libs/agno/agno/db/in_memory/in_memory_db.py:1064-1075 | libs/agno/agno/db/json/json_db.py:1318-1329 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:588 — libs/agno/agno/db/mysql/async_mysql.py:588-599 | libs/agno/agno/db/postgres/async_postgres.py:885-896 | REDACTED:840-851 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) libs/agno/agno/db/surrealdb/surrealdb.py:1863 — libs/agno/agno/db/surrealdb/surrealdb.py:1863-1874 | libs/agno/agno/db/surrealdb/surrealdb.py:2165-2176 | libs/agno/agno/db/surrealdb/surrealdb.py:2198-2209 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) libs/agno/agno/db/valkey/valkey.py:737 — libs/agno/agno/db/valkey/valkey.py:737-748 | libs/agno/agno/db/valkey/valkey.py:1320-1331 | libs/agno/agno/db/valkey/valkey.py:2174-2185 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) libs/agno/agno/metrics.py:508 — libs/agno/agno/metrics.py:508-519 | libs/agno/agno/metrics.py:748-759 | libs/agno/agno/metrics.py:791-802 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_metrics` to `"RunMetrics"` in one and `Optional[RunMetrics] = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:93 — libs/agno/agno/os/interfaces/a2a/router.py:93-104 | libs/agno/agno/os/interfaces/a2a/router.py:426-437 | libs/agno/agno/os/interfaces/a2a/router.py:753-764 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) libs/agno/agno/team/_task_tools.py:525 — libs/agno/agno/team/_task_tools.py:525-536 | libs/agno/agno/team/_task_tools.py:577-588 | libs/agno/agno/team/_task_tools.py:913-924 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_task_tools.py:525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) libs/agno/agno/utils/print_response/agent.py:659 — libs/agno/agno/utils/print_response/agent.py:659-670 | libs/agno/agno/utils/print_response/team.py:730-741 | libs/agno/agno/utils/print_response/team.py:1662-1673 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) REDACTED:961 — REDACTED:961-972 | REDACTED:1132-1143 | REDACTED:1233-1244 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:961` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) REDACTED:1098 — REDACTED:1098-1109 | REDACTED:1253-1264 | REDACTED:1411-1422 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) libs/agno_infra/agno/aws/app/base.py:213 — libs/agno_infra/agno/aws/app/base.py:213-224 | libs/agno_infra/agno/docker/app/base.py:166-177 | libs/agno_infra/agno/docker/app/postgres/postgres.py:94-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno_infra/agno/aws/app/base.py:210` calls `set_aws_env_vars` and `libs/agno_infra/agno/docker/app/base.py:163` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) libs/agno/agno/knowledge/__init__.py:29 — libs/agno/agno/knowledge/__init__.py:29-40 | libs/agno/agno/tools/file/__init__.py:40-51 | libs/agno/agno/tools/knowledge/__init__.py:28-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (12 lines × 3) cookbook/07_knowledge/09_archive/readers/batching.py:58 — cookbook/07_knowledge/09_archive/readers/batching.py:58-69 | cookbook/07_knowledge/09_archive/readers/from_path.py:66-77 | cookbook/07_knowledge/09_archive/readers/from_youtube.py:49-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (12 lines × 3) cookbook/07_knowledge/09_archive/readers/batching.py:73 — cookbook/07_knowledge/09_archive/readers/batching.py:73-84 | cookbook/07_knowledge/09_archive/readers/from_path.py:81-92 | cookbook/07_knowledge/09_archive/readers/from_youtube.py:64-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (12 lines × 3) libs/agno/agno/agent/remote.py:173 — libs/agno/agno/agent/remote.py:173-184 | libs/agno/agno/team/remote.py:166-177 | libs/agno/agno/workflow/remote.py:128-139 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×18
  • Duplicated block (10 lines × 3) cookbook/05_agent_os/05_human_in_the_loop/basic.py:90 — cookbook/05_agent_os/05_human_in_the_loop/basic.py:90-101 | cookbook/05_agent_os/05_human_in_the_loop/external_execution.py:120-130 | cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py:117-126 — before extracting anything, compare `cookbook/05_agent_os/05_human_in_the_loop/basic.py` and `cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/05_human_in_the_loop/basic.py:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) libs/agno/agno/agent/_response.py:1065 — libs/agno/agno/agent/_response.py:1065-1074 | libs/agno/agno/agent/_response.py:1229-1238 | libs/agno/agno/team/_response.py:1021-1030 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_response.py:1064` calls `_recompact_after_overflow` and `libs/agno/agno/team/_response.py:1020` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) libs/agno/agno/agent/_run.py:2427 — libs/agno/agno/agent/_run.py:2427-2438 | libs/agno/agno/agent/_run.py:2470-2481 | libs/agno/agno/team/_run.py:3931-3940 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2427` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:3929` calls `araise_if_cancelled` and `libs/agno/agno/agent/_run.py:2467` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) libs/agno/agno/agent/_session.py:419 — libs/agno/agno/agent/_session.py:419-428 | libs/agno/agno/team/_session.py:846-855 | libs/agno/agno/workflow/workflow.py:1145-1154 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) libs/agno/agno/agent/remote.py:389 — libs/agno/agno/agent/remote.py:389-398 | libs/agno/agno/team/remote.py:381-390 | libs/agno/agno/workflow/remote.py:294-303 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/remote.py:389` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) libs/agno/agno/db/mysql/mysql.py:518 — libs/agno/agno/db/mysql/mysql.py:518-528 | libs/agno/agno/db/postgres/postgres.py:973-983 | libs/agno/agno/db/singlestore/singlestore.py:598-607 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:518` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) libs/agno/agno/db/mysql/mysql.py:2104 — libs/agno/agno/db/mysql/mysql.py:2104-2113 | libs/agno/agno/db/singlestore/singlestore.py:2129-2138 | REDACTED:2914-2923 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) libs/agno/agno/db/postgres/async_postgres.py:4193 — libs/agno/agno/db/postgres/async_postgres.py:4193-4202 | libs/agno/agno/db/postgres/async_postgres.py:4256-4265 | REDACTED:4330-4339 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:4254` calls `learning_search_patterns` and `libs/agno/agno/db/postgres/async_postgres.py:4192` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) libs/agno/agno/db/singlestore/singlestore.py:2701 — libs/agno/agno/db/singlestore/singlestore.py:2701-2710 | REDACTED:3261-3270 | REDACTED:3514-3523 — before extracting anything, compare `libs/agno/agno/db/singlestore/singlestore.py` and `REDACTED` as WHOLE FILES: this scan already matched 46 separate duplicated blocks between them, totalling at least 600 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) libs/agno/agno/db/valkey/valkey.py:764 — libs/agno/agno/db/valkey/valkey.py:764-773 | libs/agno/agno/db/valkey/valkey.py:1347-1356 | libs/agno/agno/db/valkey/valkey.py:2199-2208 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/valkey/valkey.py:1346` calls `log_debug` and `libs/agno/agno/db/valkey/valkey.py:2198` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) libs/agno/agno/learn/stores/decision_log.py:1044 — libs/agno/agno/learn/stores/decision_log.py:1044-1053 | libs/agno/agno/learn/stores/user_memory.py:1474-1483 | libs/agno/agno/learn/stores/user_profile.py:1176-1185 — before extracting anything, compare `libs/agno/agno/learn/stores/user_memory.py` and `libs/agno/agno/learn/stores/user_profile.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 305 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) libs/agno/agno/models/message.py:170 — libs/agno/agno/models/message.py:170-179 | libs/agno/agno/models/message.py:196-205 | libs/agno/agno/models/message.py:219-228 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/message.py:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:132 — libs/agno/agno/os/interfaces/a2a/router.py:132-141 | libs/agno/agno/os/interfaces/a2a/router.py:465-474 | libs/agno/agno/os/interfaces/a2a/router.py:792-801 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) libs/agno/agno/utils/print_response/agent.py:464 — libs/agno/agno/utils/print_response/agent.py:464-473 | libs/agno/agno/utils/print_response/agent.py:826-835 | libs/agno/agno/utils/response.py:28-37 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (10 lines × 3) libs/agno/agno/utils/print_response/agent.py:500 — libs/agno/agno/utils/print_response/agent.py:500-509 | libs/agno/agno/utils/print_response/team.py:664-673 | libs/agno/agno/utils/print_response/team.py:1595-1604 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) REDACTED:1175 — REDACTED:1175-1184 | REDACTED:1282-1291 | REDACTED:1370-1379 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) libs/agno/agno/workflow/condition.py:215 — libs/agno/agno/workflow/condition.py:215-224 | libs/agno/agno/workflow/router.py:257-266 | libs/agno/agno/workflow/steps.py:130-139 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) libs/agno/agno/workflow/workflow.py:4680 — libs/agno/agno/workflow/workflow.py:4680-4691 | libs/agno/agno/workflow/workflow.py:9727-9738 | libs/agno/agno/workflow/workflow.py:10226-10235 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:4680` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×18
  • Duplicated block (8 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:579 — libs/agno/agno/db/mysql/async_mysql.py:579-586 | libs/agno/agno/db/postgres/async_postgres.py:876-883 | REDACTED:831-838 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:579` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:970 — libs/agno/agno/db/mysql/async_mysql.py:970-977 | libs/agno/agno/db/postgres/async_postgres.py:1549-1557 | REDACTED:1475-1484 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 3) libs/agno/agno/db/mysql/mysql.py:874 — libs/agno/agno/db/mysql/mysql.py:874-881 | libs/agno/agno/db/singlestore/singlestore.py:928-935 | REDACTED:1404-1411 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1402` calls `_get_table` and `libs/agno/agno/db/mysql/mysql.py:873` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) libs/agno/agno/db/mysql/mysql.py:2264 — libs/agno/agno/db/mysql/mysql.py:2264-2271 | libs/agno/agno/db/postgres/postgres.py:3170-3177 | REDACTED:3092-3099 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 3) libs/agno/agno/db/mysql/mysql.py:2782 — libs/agno/agno/db/mysql/mysql.py:2782-2789 | libs/agno/agno/db/postgres/postgres.py:3733-3740 | REDACTED:4347-4354 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 3) libs/agno/agno/db/postgres/postgres.py:7131 — libs/agno/agno/db/postgres/postgres.py:7131-7138 | REDACTED:2599-2607 | REDACTED:6899-6906 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 3) libs/agno/agno/knowledge/reader/csv_reader.py:93 — libs/agno/agno/knowledge/reader/csv_reader.py:93-100 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:106-113 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:196-203 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/reader/csv_reader.py:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `file` to `Union[Path, str, IO[Any]]` in one and `Union[Path, IO[Any]]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 3) libs/agno/agno/learn/stores/user_memory.py:957 — libs/agno/agno/learn/stores/user_memory.py:957-964 | libs/agno/agno/learn/stores/user_profile.py:1021-1028 | libs/agno/agno/memory/manager.py:953-960 — before extracting anything, compare `libs/agno/agno/learn/stores/user_memory.py` and `libs/agno/agno/learn/stores/user_profile.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 305 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) REDACTED:922 — REDACTED:922-929 | REDACTED:1413-1420 | REDACTED:1694-1701 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:919` calls `ModelResponse` and `REDACTED:1410` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) libs/agno/agno/os/routers/agents/router.py:2480 — libs/agno/agno/os/routers/agents/router.py:2480-2490 | libs/agno/agno/os/routers/teams/router.py:1276-1283 | libs/agno/agno/os/routers/workflows/router.py:2695-2702 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2480` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) libs/agno/agno/team/_messages.py:1029 — libs/agno/agno/team/_messages.py:1029-1036 | libs/agno/agno/team/_messages.py:1163-1170 | libs/agno/agno/team/_run.py:5321-5328 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_messages.py:1029` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) libs/agno/agno/tools/shopify.py:190 — libs/agno/agno/tools/shopify.py:190-197 | libs/agno/agno/tools/shopify.py:309-316 | libs/agno/agno/tools/shopify.py:1070-1077 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/tools/shopify.py:317` calls `get` and `libs/agno/agno/tools/shopify.py:198` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) libs/agno/agno/tools/shopify.py:709 — libs/agno/agno/tools/shopify.py:709-716 | libs/agno/agno/tools/shopify.py:983-990 | libs/agno/agno/tools/shopify.py:1354-1361 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) libs/agno/agno/utils/print_response/agent.py:141 — libs/agno/agno/utils/print_response/agent.py:141-148 | libs/agno/agno/utils/print_response/agent.py:346-353 | libs/agno/agno/utils/print_response/agent.py:889-896 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) REDACTED:491 — REDACTED:491-498 | REDACTED:561-568 | REDACTED:598-605 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) libs/agno/agno/workflow/router.py:753 — libs/agno/agno/workflow/router.py:753-760 | libs/agno/agno/workflow/router.py:943-950 | libs/agno/agno/workflow/router.py:1090-1097 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/router.py:753` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py:56 — cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py:56-63 | cookbook/07_knowledge/09_archive/vector_dbs/mongo_db.py:88-95 | cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py:64-71 — before extracting anything, compare `cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py` and `cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) libs/agno/agno/models/inception/inception.py:40 — libs/agno/agno/models/inception/inception.py:40-47 | libs/agno/agno/models/tokenlab/tokenlab.py:30-38 | libs/agno/agno/models/xiaomi/mimo.py:49-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×17
  • Duplicated block (33 lines × 2) cookbook/04_workflows/06_advanced_concepts/session_state/state_in_function.py:76 — cookbook/04_workflows/06_advanced_concepts/session_state/state_in_function.py:76-108 | cookbook/04_workflows/06_advanced_concepts/session_state/state_in_function.py:187-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33 lines × 2) cookbook/frameworks/claude-agent-sdk/background_cancel.py:30 — cookbook/frameworks/claude-agent-sdk/background_cancel.py:30-62 | cookbook/frameworks/codex/background_cancel.py:32-64 — `cookbook/frameworks/claude-agent-sdk/background_cancel.py` and `cookbook/frameworks/codex/background_cancel.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 33 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:423 — libs/agno/agno/db/gcs_json/gcs_json_db.py:423-455 | libs/agno/agno/db/json/json_db.py:470-502 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2672 — libs/agno/agno/db/mysql/async_mysql.py:2672-2704 | libs/agno/agno/db/postgres/async_postgres.py:3044-3076 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2672` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/mysql/mysql.py:1262 — libs/agno/agno/db/mysql/mysql.py:1262-1294 | libs/agno/agno/db/singlestore/singlestore.py:1320-1352 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/postgres/postgres.py:7196 — libs/agno/agno/db/postgres/postgres.py:7196-7228 | REDACTED:6964-6996 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/redis/redis.py:325 — libs/agno/agno/db/redis/redis.py:325-357 | libs/agno/agno/db/valkey/valkey.py:402-434 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/redis/redis.py:2032 — libs/agno/agno/db/redis/redis.py:2032-2064 | libs/agno/agno/db/valkey/valkey.py:2466-2498 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (33 lines × 2) libs/agno/agno/db/redis/redis.py:2389 — libs/agno/agno/db/redis/redis.py:2389-2421 | libs/agno/agno/db/valkey/valkey.py:2895-2927 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/valkey/valkey.py:2931` calls `_learning_matches`, `all`, `get` and `libs/agno/agno/db/redis/redis.py:2424` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (33 lines × 2) libs/agno/agno/knowledge/reader/website_reader.py:228 — libs/agno/agno/knowledge/reader/website_reader.py:228-260 | libs/agno/agno/knowledge/reader/website_reader.py:343-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33 lines × 2) libs/agno/agno/team/_response.py:1113 — libs/agno/agno/team/_response.py:1113-1145 | libs/agno/agno/team/_response.py:1276-1308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33 lines × 2) libs/agno/agno/utils/print_response/team.py:49 — libs/agno/agno/utils/print_response/team.py:49-81 | libs/agno/agno/utils/print_response/team.py:984-1016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33 lines × 2) libs/agno/agno/workflow/condition.py:747 — libs/agno/agno/workflow/condition.py:747-779 | libs/agno/agno/workflow/condition.py:1200-1232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:747` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33 lines × 2) libs/agno/agno/workflow/parallel.py:644 — libs/agno/agno/workflow/parallel.py:644-676 | libs/agno/agno/workflow/parallel.py:997-1029 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/parallel.py:994` calls `gather` and `libs/agno/agno/workflow/parallel.py:641` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (33 lines × 2) libs/agno/agno/workflow/step.py:1278 — libs/agno/agno/workflow/step.py:1278-1310 | libs/agno/agno/workflow/step.py:1999-2031 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1278` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33 lines × 2) libs/agno/agno/workflow/step.py:1743 — libs/agno/agno/workflow/step.py:1743-1775 | libs/agno/agno/workflow/step.py:2470-2502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1743` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33 lines × 2) libs/agno/agno/workflow/steps.py:396 — libs/agno/agno/workflow/steps.py:396-428 | libs/agno/agno/workflow/steps.py:701-733 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×16
  • Duplicated block (16 lines × 3) cookbook/environments/_22_sql_generation/basic.py:24 — cookbook/environments/_22_sql_generation/basic.py:24-39 | cookbook/environments/_22_sql_generation/joins.py:23-38 | cookbook/environments/_22_sql_generation/window_functions.py:24-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 3) libs/agno/agno/agent/_run.py:504 — libs/agno/agno/agent/_run.py:504-519 | libs/agno/agno/agent/_run.py:1655-1670 | libs/agno/agno/agent/_run.py:2272-2287 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:504` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) libs/agno/agno/agent/_run.py:1363 — libs/agno/agno/agent/_run.py:1363-1378 | libs/agno/agno/agent/_run.py:2746-2761 | libs/agno/agno/team/_run.py:4188-4203 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (16 lines × 3) libs/agno/agno/agent/_run.py:3524 — libs/agno/agno/agent/_run.py:3524-3539 | libs/agno/agno/agent/_run.py:4858-4874 | libs/agno/agno/agent/_run.py:5377-5393 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (16 lines × 3) libs/agno/agno/agent/remote.py:286 — libs/agno/agno/agent/remote.py:286-301 | libs/agno/agno/team/remote.py:279-294 | libs/agno/agno/workflow/remote.py:206-221 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/remote.py:286` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 3) libs/agno/agno/agent/remote.py:315 — libs/agno/agno/agent/remote.py:315-330 | libs/agno/agno/team/remote.py:308-323 | libs/agno/agno/workflow/workflow.py:10875-10890 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/remote.py:315` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:539 — libs/agno/agno/db/mysql/async_mysql.py:539-554 | libs/agno/agno/db/mysql/mysql.py:536-551 | libs/agno/agno/db/singlestore/singlestore.py:615-630 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:555` calls `execute` and `libs/agno/agno/db/mysql/mysql.py:552` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1357 — libs/agno/agno/db/mysql/async_mysql.py:1357-1372 | libs/agno/agno/db/mysql/mysql.py:1341-1356 | libs/agno/agno/db/singlestore/singlestore.py:1393-1408 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1410 — libs/agno/agno/db/mysql/async_mysql.py:1410-1425 | libs/agno/agno/db/mysql/async_mysql.py:1461-1476 | libs/agno/agno/db/mysql/async_mysql.py:1512-1527 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1410` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) libs/agno/agno/db/postgres/postgres.py:237 — libs/agno/agno/db/postgres/postgres.py:237-252 | REDACTED:141-156 | REDACTED:183-198 — before extracting anything, compare `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` as WHOLE FILES: this scan already matched 107 separate duplicated blocks between them, totalling at least 1336 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) libs/agno/agno/learn/stores/learned_knowledge.py:1368 — libs/agno/agno/learn/stores/learned_knowledge.py:1368-1383 | libs/agno/agno/learn/stores/user_memory.py:944-959 | libs/agno/agno/learn/stores/user_profile.py:1008-1023 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/learn/stores/user_memory.py:960` calls `log_debug` and `libs/agno/agno/learn/stores/learned_knowledge.py:1384` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 3) libs/agno/agno/os/routers/agents/router.py:2267 — libs/agno/agno/os/routers/agents/router.py:2267-2284 | libs/agno/agno/os/routers/teams/router.py:2153-2168 | libs/agno/agno/os/routers/workflows/router.py:2830-2845 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2267` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 3) libs/agno/agno/team/_run.py:1006 — libs/agno/agno/team/_run.py:1006-1021 | libs/agno/agno/team/_run.py:1806-1821 | libs/agno/agno/team/_run.py:8562-8577 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (16 lines × 3) libs/agno/agno/tools/google/gmail.py:903 — libs/agno/agno/tools/google/gmail.py:903-918 | libs/agno/agno/tools/google/gmail.py:922-937 | libs/agno/agno/tools/google/gmail.py:941-956 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 3) libs/agno/agno/workflow/workflow.py:7922 — libs/agno/agno/workflow/workflow.py:7922-7937 | libs/agno/agno/workflow/workflow.py:8177-8194 | libs/agno/agno/workflow/workflow.py:9937-9954 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:7938` calls `_check_failed_step` and `libs/agno/agno/workflow/workflow.py:8196` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 3) cookbook/04_workflows/01_basic_workflows/01_sequence_of_steps/sequence_of_steps.py:96 — cookbook/04_workflows/01_basic_workflows/01_sequence_of_steps/sequence_of_steps.py:96-111 | cookbook/04_workflows/01_basic_workflows/01_sequence_of_steps/sequence_with_functions.py:111-126 | cookbook/04_workflows/01_basic_workflows/01_sequence_of_steps/sequence_with_functions.py:185-200 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×16
  • Duplicated block (13–14 lines × 2) libs/agno/agno/agent/_managers.py:308 — libs/agno/agno/agent/_managers.py:308-321 | libs/agno/agno/team/_managers.py:227-239 — `libs/agno/agno/agent/_managers.py` and `libs/agno/agno/team/_managers.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 100 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_managers.py:308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/agent/_response.py:755 — libs/agno/agno/agent/_response.py:755-767 | libs/agno/agno/team/_response.py:805-818 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:755` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/agent/_run.py:733 — libs/agno/agno/agent/_run.py:733-746 | libs/agno/agno/agent/_run.py:3848-3860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/db/firestore/firestore.py:726 — libs/agno/agno/db/firestore/firestore.py:726-739 | libs/agno/agno/db/redis/redis.py:696-708 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/db/firestore/firestore.py:1342 — libs/agno/agno/db/firestore/firestore.py:1342-1354 | libs/agno/agno/db/firestore/firestore.py:2120-2133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3490 — libs/agno/agno/db/mongo/async_mongo.py:3490-3503 | libs/agno/agno/db/mongo/mongo.py:3347-3359 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/db/postgres/postgres.py:2814 — libs/agno/agno/db/postgres/postgres.py:2814-2827 | libs/agno/agno/db/singlestore/singlestore.py:1955-1967 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:2830` calls `sanitize_postgres_string` and `libs/agno/agno/db/singlestore/singlestore.py:1969` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/eval/performance.py:535 — libs/agno/agno/eval/performance.py:535-548 | libs/agno/agno/eval/performance.py:676-688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/knowledge/embedder/cohere.py:197 — libs/agno/agno/knowledge/embedder/cohere.py:197-209 | libs/agno/agno/knowledge/embedder/cohere.py:252-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/embedder/cohere.py:252` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:118 — libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:118-131 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:206-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) REDACTED:2314 — REDACTED:2314-2327 | REDACTED:3006-3018 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/models/openai/responses.py:734 — libs/agno/agno/models/openai/responses.py:734-746 | libs/agno/agno/utils/models/ai_foundry.py:25-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/tools/python.py:113 — libs/agno/agno/tools/python.py:113-126 | libs/agno/agno/tools/python.py:142-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/vectordb/surrealdb/surrealdb.py:514 — libs/agno/agno/vectordb/surrealdb/surrealdb.py:514-527 | libs/agno/agno/vectordb/surrealdb/surrealdb.py:892-904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/workflow/parallel.py:606 — libs/agno/agno/workflow/parallel.py:606-619 | libs/agno/agno/workflow/parallel.py:969-981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) libs/agno/agno/workflow/workflow.py:5917 — libs/agno/agno/workflow/workflow.py:5917-5930 | libs/agno/agno/workflow/workflow.py:6334-6346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5917` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:6348` calls `_broadcast_to_websocket` and `libs/agno/agno/workflow/workflow.py:5931` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×16
  • Duplicated block (12 lines × 4) libs/agno/agno/agent/_default_tools.py:146 — libs/agno/agno/agent/_default_tools.py:146-157 | libs/agno/agno/agent/_default_tools.py:179-190 | libs/agno/agno/team/_default_tools.py:1652-1663 | libs/agno/agno/team/_default_tools.py:1683-1694 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_default_tools.py:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 4) libs/agno/agno/agent/_run.py:427 — libs/agno/agno/agent/_run.py:427-438 | libs/agno/agno/agent/_run.py:835-846 | libs/agno/agno/agent/_run.py:1574-1585 | libs/agno/agno/agent/_run.py:2181-2192 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 4) libs/agno/agno/agent/_run.py:1265 — libs/agno/agno/agent/_run.py:1265-1276 | libs/agno/agno/agent/_run.py:2643-2655 | libs/agno/agno/team/_run.py:1857-1868 | libs/agno/agno/team/_run.py:4076-4088 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 4) libs/agno/agno/agent/_run.py:2493 — libs/agno/agno/agent/_run.py:2493-2504 | libs/agno/agno/agent/_run.py:5609-5620 | libs/agno/agno/team/_run.py:3953-3964 | libs/agno/agno/team/_run.py:10359-10370 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2493` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) libs/agno/agno/client/os.py:146 — libs/agno/agno/client/os.py:146-157 | libs/agno/agno/client/os.py:206-217 | libs/agno/agno/client/os.py:358-369 | libs/agno/agno/client/os.py:2431-2442 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 4) libs/agno/agno/db/mongo/async_mongo.py:1903 — libs/agno/agno/db/mongo/async_mongo.py:1903-1914 | libs/agno/agno/db/mongo/mongo.py:1710-1721 | libs/agno/agno/db/mysql/async_mysql.py:2099-2110 | libs/agno/agno/db/singlestore/singlestore.py:2095-2106 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1903` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:246 — libs/agno/agno/db/mysql/async_mysql.py:246-257 | libs/agno/agno/db/mysql/mysql.py:241-252 | libs/agno/agno/db/postgres/async_postgres.py:416-427 | libs/agno/agno/db/singlestore/singlestore.py:311-322 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:1716 — libs/agno/agno/db/postgres/async_postgres.py:1716-1727 | libs/agno/agno/db/postgres/postgres.py:1947-1958 | REDACTED:1645-1656 | REDACTED:1901-1912 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:1716` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4330 — libs/agno/agno/db/postgres/async_postgres.py:4330-4341 | libs/agno/agno/db/postgres/postgres.py:7061-7072 | REDACTED:4402-4413 | REDACTED:6829-6840 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6359 — libs/agno/agno/db/postgres/async_postgres.py:6359-6370 | libs/agno/agno/db/postgres/postgres.py:9112-9123 | REDACTED:5528-5539 | REDACTED:8041-8052 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 4) libs/agno/agno/eval/accuracy.py:461 — libs/agno/agno/eval/accuracy.py:461-472 | libs/agno/agno/eval/accuracy.py:602-613 | libs/agno/agno/eval/accuracy.py:715-726 | libs/agno/agno/eval/accuracy.py:827-838 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/eval/accuracy.py:711` calls `isinstance`, `log_error` and `libs/agno/agno/eval/accuracy.py:826` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 4) libs/agno/agno/knowledge/embedder/openai.py:73 — libs/agno/agno/knowledge/embedder/openai.py:73-84 | libs/agno/agno/knowledge/embedder/openai.py:109-120 | libs/agno/agno/knowledge/embedder/openai.py:130-141 | libs/agno/agno/knowledge/embedder/openai.py:171-182 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 4) libs/agno/agno/os/routers/teams/router.py:165 — libs/agno/agno/os/routers/teams/router.py:165-177 | libs/agno/agno/os/routers/teams/router.py:237-248 | libs/agno/agno/os/routers/teams/router.py:480-494 | libs/agno/agno/os/routers/teams/router.py:547-558 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 4) libs/agno/agno/team/_default_tools.py:726 — libs/agno/agno/team/_default_tools.py:726-738 | libs/agno/agno/team/_default_tools.py:912-924 | libs/agno/agno/team/_task_tools.py:530-541 | libs/agno/agno/team/_task_tools.py:713-724 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (12 lines × 4) libs/agno/agno/team/_run.py:1759 — libs/agno/agno/team/_run.py:1759-1770 | libs/agno/agno/team/_run.py:3960-3971 | libs/agno/agno/team/_run.py:8528-8539 | libs/agno/agno/team/_run.py:10366-10377 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1759` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) libs/agno/agno/workflow/condition.py:589 — libs/agno/agno/workflow/condition.py:589-600 | libs/agno/agno/workflow/condition.py:1042-1053 | libs/agno/agno/workflow/steps.py:317-328 | libs/agno/agno/workflow/steps.py:623-634 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/steps.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 261 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:589` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/condition.py:587` calls `log_debug` and `libs/agno/agno/workflow/condition.py:1041` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D30 · Dependency Vulnerabilities · Medium CVE · ×15
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×15
  • Duplicated block (14–15 lines × 2) cookbook/05_agent_os/01_getting_started/run_over_http.py:64 — cookbook/05_agent_os/01_getting_started/run_over_http.py:64-78 | cookbook/05_agent_os/09_serving_workflows/run_over_api.py:53-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/01_getting_started/run_over_http.py:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1463 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1463-1476 | libs/agno/agno/db/json/json_db.py:1562-1576 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) REDACTED:936 — REDACTED:936-949 | REDACTED:1135-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) REDACTED:1538 — REDACTED:1538-1552 | REDACTED:1742-1755 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/db/mysql/mysql.py:282 — libs/agno/agno/db/mysql/mysql.py:282-296 | libs/agno/agno/db/postgres/postgres.py:566-579 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:282` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) REDACTED:2272 — REDACTED:2272-2286 | REDACTED:3206-3219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3204` calls `order_by`, `desc` and `REDACTED:2269` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/db/surrealdb/surrealdb.py:731 — libs/agno/agno/db/surrealdb/surrealdb.py:731-744 | libs/agno/agno/db/surrealdb/surrealdb.py:1114-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/surrealdb/surrealdb.py:731` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/eval/accuracy.py:468 — libs/agno/agno/eval/accuracy.py:468-481 | libs/agno/agno/eval/accuracy.py:609-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/integrations/discord/client.py:115 — libs/agno/agno/integrations/discord/client.py:115-128 | libs/agno/agno/integrations/discord/client.py:132-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/integrations/discord/client.py:115` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/team/_task_tools.py:551 — libs/agno/agno/team/_task_tools.py:551-565 | libs/agno/agno/team/_task_tools.py:735-748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/tools/coding.py:777 — libs/agno/agno/tools/coding.py:777-791 | libs/agno/agno/tools/coding.py:832-845 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/tools/file/file.py:375 — libs/agno/agno/tools/file/file.py:375-389 | libs/agno/agno/tools/workspace.py:825-838 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `limit` to `int = 10` in one and `int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/tools/file/file.py:374` calls `log_debug` and `libs/agno/agno/tools/workspace.py:823` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/tools/models/nebius.py:92 — libs/agno/agno/tools/models/nebius.py:92-106 | libs/agno/agno/tools/openai.py:131-144 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/models/nebius.py:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) libs/agno/agno/workflow/step.py:1144 — libs/agno/agno/workflow/step.py:1144-1158 | libs/agno/agno/workflow/step.py:1828-1841 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/step.py:1827` calls `_is_generator_function` and `libs/agno/agno/workflow/step.py:1143` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) libs/agno_infra/agno/aws/resource/elb/listener.py:70 — libs/agno_infra/agno/aws/resource/elb/listener.py:70-84 | libs/agno_infra/agno/aws/resource/elb/listener.py:193-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno_infra/agno/aws/resource/elb/listener.py:66` calls `get_listener_tags` and `libs/agno_infra/agno/aws/resource/elb/listener.py:191` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×14
  • Duplicated block (34 lines × 2) libs/agno/agno/client/os.py:954 — libs/agno/agno/client/os.py:954-987 | libs/agno/agno/client/os.py:1008-1041 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4473 — libs/agno/agno/db/postgres/async_postgres.py:4473-4506 | REDACTED:4546-4579 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (34 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4582 — libs/agno/agno/db/postgres/async_postgres.py:4582-4615 | REDACTED:4655-4688 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34 lines × 2) libs/agno/agno/db/redis/redis.py:1207 — libs/agno/agno/db/redis/redis.py:1207-1240 | libs/agno/agno/db/valkey/valkey.py:1501-1534 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34 lines × 2) REDACTED:1872 — REDACTED:1872-1905 | REDACTED:2129-2162 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1872` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (34 lines × 2) libs/agno/agno/memory/strategies/summarize.py:49 — libs/agno/agno/memory/strategies/summarize.py:49-82 | libs/agno/agno/memory/strategies/summarize.py:126-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (34 lines × 2) REDACTED:2485 — REDACTED:2485-2518 | REDACTED:2701-2734 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (34 lines × 2) libs/agno/agno/os/routers/agents/router.py:1607 — libs/agno/agno/os/routers/agents/router.py:1607-1640 | libs/agno/agno/os/routers/teams/router.py:1558-1591 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/agents/router.py:1605` calls `RunRequirement` and `libs/agno/agno/os/routers/teams/router.py:1557` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (34 lines × 2) libs/agno/agno/os/routers/teams/router.py:1237 — libs/agno/agno/os/routers/teams/router.py:1237-1270 | libs/agno/agno/os/routers/workflows/router.py:2656-2689 — `libs/agno/agno/os/routers/teams/router.py` and `libs/agno/agno/os/routers/workflows/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 15 separate duplicated blocks between them, totalling at least 391 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/teams/router.py:1237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34 lines × 2) libs/agno/agno/team/_run.py:3886 — libs/agno/agno/team/_run.py:3886-3919 | libs/agno/agno/team/_run.py:10310-10343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:3886` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:3880` calls `araise_if_cancelled` and `libs/agno/agno/team/_run.py:10304` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (34 lines × 2) libs/agno/agno/team/_storage.py:1026 — libs/agno/agno/team/_storage.py:1026-1059 | libs/agno/agno/team/_storage.py:1092-1125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_storage.py:1026` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (34 lines × 2) libs/agno/agno/utils/print_response/team.py:323 — libs/agno/agno/utils/print_response/team.py:323-356 | libs/agno/agno/utils/print_response/team.py:1256-1289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/team.py:323` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (34 lines × 2) libs/agno/agno/utils/print_response/workflow.py:331 — libs/agno/agno/utils/print_response/workflow.py:331-364 | libs/agno/agno/utils/print_response/workflow.py:1192-1225 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/workflow.py:331` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34 lines × 2) REDACTED:1117 — REDACTED:1117-1150 | REDACTED:1218-1251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×14
  • Duplicated block (29 lines × 2) libs/agno/agno/compaction/compaction.py:954 — libs/agno/agno/compaction/compaction.py:954-982 | libs/agno/agno/compaction/compaction.py:1014-1042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/compaction/compaction.py:954` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) REDACTED:1271 — REDACTED:1271-1299 | REDACTED:1397-1425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4394 — libs/agno/agno/db/postgres/async_postgres.py:4394-4422 | REDACTED:4466-4494 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (29 lines × 2) libs/agno/agno/db/postgres/postgres.py:6905 — libs/agno/agno/db/postgres/postgres.py:6905-6933 | REDACTED:6676-6704 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) libs/agno/agno/db/redis/redis.py:1710 — libs/agno/agno/db/redis/redis.py:1710-1738 | libs/agno/agno/db/valkey/valkey.py:2096-2124 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) libs/agno/agno/knowledge/knowledge.py:891 — libs/agno/agno/knowledge/knowledge.py:891-919 | libs/agno/agno/knowledge/knowledge.py:1060-1088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/knowledge.py:891` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (29 lines × 2) libs/agno/agno/team/_task_tools.py:868 — libs/agno/agno/team/_task_tools.py:868-896 | libs/agno/agno/team/_task_tools.py:1073-1101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) libs/agno/agno/tools/minimax.py:119 — libs/agno/agno/tools/minimax.py:119-147 | libs/agno/agno/tools/minimax.py:201-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/minimax.py:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) REDACTED:1652 — REDACTED:1652-1680 | REDACTED:1512-1540 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) libs/agno/agno/workflow/step.py:420 — libs/agno/agno/workflow/step.py:420-448 | libs/agno/agno/workflow/step.py:529-557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: `Team` names `agno.team` in one and `agno.team.team` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (29 lines × 2) libs/agno/agno/workflow/workflow.py:6003 — libs/agno/agno/workflow/workflow.py:6003-6031 | libs/agno/agno/workflow/workflow.py:6419-6447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:6000` calls `log_debug` and `libs/agno/agno/workflow/workflow.py:6416` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (29 lines × 2) libs/agno/agno/workflow/workflow.py:7454 — libs/agno/agno/workflow/workflow.py:7454-7482 | libs/agno/agno/workflow/workflow.py:9500-9528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29 lines × 2) libs/agno/agno/workflow/workflow.py:7817 — libs/agno/agno/workflow/workflow.py:7817-7845 | libs/agno/agno/workflow/workflow.py:9577-9605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (29 lines × 2) libs/agno/agno/workflow/workflow.py:7869 — libs/agno/agno/workflow/workflow.py:7869-7897 | libs/agno/agno/workflow/workflow.py:9629-9657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:7869` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×14
  • Duplicated block (18–19 lines × 2) libs/agno/agno/agent/_response.py:219 — libs/agno/agno/agent/_response.py:219-237 | libs/agno/agno/team/_response.py:633-650 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:219` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `TeamRunOutput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/agent/_run.py:3351 — libs/agno/agno/agent/_run.py:3351-3368 | libs/agno/agno/agent/_run.py:4245-4263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/agent/_tools.py:1089 — libs/agno/agno/agent/_tools.py:1089-1106 | libs/agno/agno/agent/_tools.py:1141-1159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:1089` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:846 — libs/agno/agno/db/gcs_json/gcs_json_db.py:846-863 | libs/agno/agno/db/json/json_db.py:909-927 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 2) REDACTED:254 — REDACTED:254-272 | REDACTED:587-604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1239 — libs/agno/agno/db/mongo/async_mongo.py:1239-1256 | libs/agno/agno/db/mongo/mongo.py:1047-1065 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/db/mongo/utils.py:40 — libs/agno/agno/db/mongo/utils.py:40-58 | libs/agno/agno/db/mongo/utils.py:85-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `collection` to `Collection` in one and `Any` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/db/mysql/mysql.py:1590 — libs/agno/agno/db/mysql/mysql.py:1590-1608 | libs/agno/agno/db/singlestore/singlestore.py:1636-1653 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/db/redis/redis.py:635 — libs/agno/agno/db/redis/redis.py:635-653 | libs/agno/agno/db/redis/redis.py:1762-1779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:635` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/knowledge/knowledge.py:2651 — libs/agno/agno/knowledge/knowledge.py:2651-2668 | libs/agno/agno/knowledge/knowledge.py:2837-2855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/knowledge/knowledge.py:5137 — libs/agno/agno/knowledge/knowledge.py:5137-5154 | libs/agno/agno/knowledge/knowledge.py:5199-5217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/knowledge.py:5137` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/os/routers/workflows/router.py:2544 — libs/agno/agno/os/routers/workflows/router.py:2544-2562 | libs/agno/agno/os/routers/workflows/router.py:2775-2792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/workflows/router.py:2544` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/utils/print_response/agent.py:88 — libs/agno/agno/utils/print_response/agent.py:88-105 | libs/agno/agno/utils/print_response/agent.py:293-311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/agent.py:293` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18–19 lines × 2) libs/agno/agno/workflow/parallel.py:519 — libs/agno/agno/workflow/parallel.py:519-537 | libs/agno/agno/workflow/parallel.py:886-903 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×14
  • Duplicated block (7 lines × 3) libs/agno/agno/db/dynamo/dynamo.py:528 — libs/agno/agno/db/dynamo/dynamo.py:528-534 | libs/agno/agno/db/redis/redis.py:562-568 | libs/agno/agno/db/valkey/valkey.py:648-654 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) libs/agno/agno/db/mysql/mysql.py:291 — libs/agno/agno/db/mysql/mysql.py:291-297 | libs/agno/agno/db/postgres/postgres.py:574-580 | libs/agno/agno/db/singlestore/singlestore.py:394-400 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/mysql.py:298` calls `log_info` and `libs/agno/agno/db/postgres/postgres.py:582` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) libs/agno/agno/db/postgres/postgres.py:429 — libs/agno/agno/db/postgres/postgres.py:429-435 | libs/agno/agno/db/singlestore/singlestore.py:278-284 | REDACTED:436-442 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/postgres.py:426` calls `pop` and `libs/agno/agno/db/singlestore/singlestore.py:277` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) libs/agno/agno/fs/base.py:35 — libs/agno/agno/fs/base.py:35-41 | libs/agno/agno/tools/file/file.py:51-57 | libs/agno/agno/tools/workspace.py:174-180 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) libs/agno/agno/knowledge/embedder/azure_openai.py:191 — libs/agno/agno/knowledge/embedder/azure_openai.py:191-198 | libs/agno/agno/knowledge/embedder/mistral.py:174-180 | libs/agno/agno/knowledge/embedder/voyageai.py:140-146 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) libs/agno/agno/learn/stores/session_context.py:447 — libs/agno/agno/learn/stores/session_context.py:447-453 | libs/agno/agno/learn/stores/user_memory.py:599-605 | libs/agno/agno/learn/stores/user_profile.py:767-773 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) libs/agno/agno/os/routers/agents/router.py:185 — libs/agno/agno/os/routers/agents/router.py:185-191 | libs/agno/agno/os/routers/agents/router.py:281-287 | libs/agno/agno/os/routers/agents/router.py:486-492 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:185` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) libs/agno/agno/os/routers/registry/registry.py:447 — libs/agno/agno/os/routers/registry/registry.py:447-453 | libs/agno/agno/os/routers/registry/registry.py:466-472 | libs/agno/agno/os/routers/registry/registry.py:484-493 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/registry/registry.py:447` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/routers/registry/registry.py:455` calls `_sandboxed` and `libs/agno/agno/os/routers/registry/registry.py:474` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) libs/agno/agno/os/routers/workflows/router.py:1218 — libs/agno/agno/os/routers/workflows/router.py:1218-1224 | libs/agno/agno/os/routers/workflows/router.py:1393-1399 | libs/agno/agno/workflow/workflow.py:5288-5296 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) libs/agno/agno/team/_run.py:553 — libs/agno/agno/team/_run.py:553-560 | libs/agno/agno/team/_run.py:1413-1425 | libs/agno/agno/team/_run.py:8353-8359 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) libs/agno/agno/tools/file/generation.py:121 — libs/agno/agno/tools/file/generation.py:121-127 | libs/agno/agno/tools/slack.py:220-226 | libs/agno/agno/tools/telegram.py:72-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) libs/agno/agno/workflow/condition.py:211 — libs/agno/agno/workflow/condition.py:211-217 | libs/agno/agno/workflow/loop.py:215-221 | libs/agno/agno/workflow/parallel.py:117-123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) libs/agno/agno/workflow/condition.py:227 — libs/agno/agno/workflow/condition.py:227-233 | libs/agno/agno/workflow/parallel.py:125-131 | libs/agno/agno/workflow/steps.py:138-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:227` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) libs/agno/agno/api/agent.py:7 — libs/agno/agno/api/agent.py:7-13 | libs/agno/agno/api/team.py:7-13 | libs/agno/agno/api/workflow.py:7-13 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `run` to `AgentRunCreate` in one and `TeamRunCreate` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×14
  • Duplicated block (5 lines × 3) libs/agno/agno/agent/_storage.py:552 — libs/agno/agno/agent/_storage.py:552-556 | libs/agno/agno/team/_storage.py:312-316 | libs/agno/agno/workflow/workflow.py:2219-2223 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_storage.py:552` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) libs/agno/agno/client/os.py:1812 — libs/agno/agno/client/os.py:1812-1816 | libs/agno/agno/client/os.py:2099-2103 | libs/agno/agno/client/os.py:2162-2166 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:880 — libs/agno/agno/db/mysql/async_mysql.py:880-885 | libs/agno/agno/db/postgres/async_postgres.py:1263-1268 | REDACTED:1220-1224 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1262` calls `_collect_sandbox_leftovers` and `libs/agno/agno/db/mysql/async_mysql.py:879` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1192 — libs/agno/agno/db/mysql/async_mysql.py:1192-1196 | libs/agno/agno/db/mysql/mysql.py:1185-1189 | libs/agno/agno/db/singlestore/singlestore.py:1242-1246 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) libs/agno/agno/db/mysql/mysql.py:107 — libs/agno/agno/db/mysql/mysql.py:107-116 | libs/agno/agno/db/postgres/postgres.py:233-242 | REDACTED:140-144 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 3) libs/agno/agno/db/mysql/mysql.py:3060 — libs/agno/agno/db/mysql/mysql.py:3060-3064 | libs/agno/agno/db/mysql/mysql.py:3152-3156 | libs/agno/agno/db/singlestore/singlestore.py:3000-3004 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 3) libs/agno/agno/os/routers/company/products.py:57 — libs/agno/agno/os/routers/company/products.py:57-61 | libs/agno/agno/os/routers/company/projects.py:76-80 | libs/agno/agno/os/routers/company/tasks.py:73-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/company/products.py:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/routers/company/projects.py:82` calls `Query` and `libs/agno/agno/os/routers/company/products.py:63` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) libs/agno/agno/os/schema.py:835 — libs/agno/agno/os/schema.py:835-839 | libs/agno/agno/os/schema.py:971-975 | libs/agno/agno/os/schema.py:1045-1049 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/schema.py:842` calls `to_utc_datetime`, `get` and `libs/agno/agno/os/schema.py:978` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) libs/agno/agno/team/_run.py:7726 — libs/agno/agno/team/_run.py:7726-7730 | libs/agno/agno/team/_run.py:9541-9546 | libs/agno/agno/team/_run.py:10020-10025 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:9541` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) libs/agno/agno/tools/csv_toolkit.py:73 — libs/agno/agno/tools/csv_toolkit.py:73-77 | libs/agno/agno/tools/csv_toolkit.py:103-107 | libs/agno/agno/tools/csv_toolkit.py:137-142 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) libs/agno/agno/tools/google/gmail.py:1526 — libs/agno/agno/tools/google/gmail.py:1526-1530 | libs/agno/agno/tools/google/gmail.py:1648-1652 | libs/agno/agno/tools/google/gmail.py:1779-1783 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) REDACTED:1833 — REDACTED:1833-1837 | REDACTED:219-223 | REDACTED:881-885 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) libs/agno_infra/agno/cli/operator.py:75 — libs/agno_infra/agno/cli/operator.py:75-79 | libs/agno_infra/agno/cli/operator.py:150-154 | libs/agno_infra/agno/cli/operator.py:223-227 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) libs/agno/agno/tools/google/drive.py:649 — libs/agno/agno/tools/google/drive.py:649-653 | libs/agno/agno/tools/google/drive.py:698-702 | libs/agno/agno/tools/google/drive.py:776-780 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×13
  • Members sharing a duplicated core (7 members, 50+ identical tokens) cookbook/12_context/18_gmail.py:59 — cookbook/12_context/18_gmail.py:59-83 | cookbook/12_context/18_gmail.py:94-118 | cookbook/12_context/19_calendar.py:59-84 | cookbook/12_context/19_calendar.py:95-119 | cookbook/12_context/25_write_tools_restriction.py:46-81 | cookbook/12_context/25_write_tools_restriction.py:92-126 | cookbook/12_context/25_write_tools_restriction.py:137-173 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/dynamo/dynamo.py:2512 — libs/agno/agno/db/dynamo/dynamo.py:2512-2622 | libs/agno/agno/db/firestore/firestore.py:2218-2305 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1596-1681 | libs/agno/agno/db/json/json_db.py:1700-1785 | libs/agno/agno/db/redis/redis.py:1966-2064 | libs/agno/agno/db/surrealdb/surrealdb.py:1768-1874 | libs/agno/agno/db/valkey/valkey.py:2400-2498 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py:1866 — libs/agno/agno/db/mongo/async_mongo.py:1866-1914 | libs/agno/agno/db/mongo/mongo.py:1671-1721 | libs/agno/agno/db/mysql/async_mysql.py:2043-2110 | libs/agno/agno/db/mysql/mysql.py:2014-2081 | libs/agno/agno/db/singlestore/singlestore.py:2043-2106 | REDACTED:2571-2637 | REDACTED:2826-2891 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:605 — libs/agno/agno/db/mysql/async_mysql.py:605-619 | libs/agno/agno/db/mysql/mysql.py:599-612 | libs/agno/agno/db/postgres/async_postgres.py:902-914 | libs/agno/agno/db/postgres/postgres.py:1056-1067 | libs/agno/agno/db/singlestore/singlestore.py:678-690 | REDACTED:857-871 | REDACTED:1045-1058 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:1797 — libs/agno/agno/db/mysql/async_mysql.py:1797-1864 | libs/agno/agno/db/mysql/mysql.py:1772-1838 | libs/agno/agno/db/postgres/async_postgres.py:2193-2260 | libs/agno/agno/db/postgres/postgres.py:2650-2715 | libs/agno/agno/db/singlestore/singlestore.py:1797-1862 | REDACTED:2300-2366 | REDACTED:2557-2622 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:2231 — libs/agno/agno/db/mysql/async_mysql.py:2231-2280 | libs/agno/agno/db/mysql/mysql.py:2198-2245 | libs/agno/agno/db/postgres/async_postgres.py:2566-2626 | libs/agno/agno/db/postgres/postgres.py:3095-3154 | libs/agno/agno/db/singlestore/singlestore.py:2225-2272 | REDACTED:2760-2819 | REDACTED:3012-3071 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:2709 — libs/agno/agno/db/mysql/async_mysql.py:2709-2742 | libs/agno/agno/db/mysql/mysql.py:2677-2711 | libs/agno/agno/db/postgres/async_postgres.py:3081-3118 | libs/agno/agno/db/postgres/postgres.py:3624-3662 | libs/agno/agno/db/singlestore/singlestore.py:2673-2710 | REDACTED:3230-3270 | REDACTED:3483-3523 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:2826 — libs/agno/agno/db/mysql/async_mysql.py:2826-2852 | libs/agno/agno/db/mysql/mysql.py:2793-2819 | libs/agno/agno/db/postgres/async_postgres.py:3200-3226 | libs/agno/agno/db/postgres/postgres.py:3744-3770 | libs/agno/agno/db/singlestore/singlestore.py:2734-2760 | REDACTED:3352-3378 | REDACTED:3548-3574 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:2855 — libs/agno/agno/db/mysql/async_mysql.py:2855-2885 | libs/agno/agno/db/mysql/mysql.py:2822-2852 | libs/agno/agno/db/postgres/async_postgres.py:3229-3257 | libs/agno/agno/db/postgres/postgres.py:3773-3801 | libs/agno/agno/db/singlestore/singlestore.py:2763-2793 | REDACTED:3381-3411 | REDACTED:3577-3607 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:2972 — libs/agno/agno/db/mysql/async_mysql.py:2972-3018 | libs/agno/agno/db/mysql/mysql.py:2939-2984 | libs/agno/agno/db/postgres/async_postgres.py:3355-3401 | libs/agno/agno/db/postgres/postgres.py:3899-3944 | libs/agno/agno/db/singlestore/singlestore.py:2879-2924 | REDACTED:3501-3547 | REDACTED:3697-3741 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:3124 — libs/agno/agno/db/mysql/async_mysql.py:3124-3227 | libs/agno/agno/db/mysql/mysql.py:3088-3189 | libs/agno/agno/db/postgres/async_postgres.py:3520-3697 | libs/agno/agno/db/postgres/postgres.py:4061-4238 | libs/agno/agno/db/singlestore/singlestore.py:3028-3141 | REDACTED:3665-3844 | REDACTED:3864-4044 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/knowledge/embedder/aws_bedrock.py:332 — libs/agno/agno/knowledge/embedder/aws_bedrock.py:332-356 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:393-424 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:430-469 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:472-491 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:494-515 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:518-543 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:549-575 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) libs/agno/agno/tools/google/gmail.py:399 — libs/agno/agno/tools/google/gmail.py:399-427 | libs/agno/agno/tools/google/gmail.py:431-461 | libs/agno/agno/tools/google/gmail.py:465-493 | libs/agno/agno/tools/google/gmail.py:518-546 | libs/agno/agno/tools/google/gmail.py:550-579 | libs/agno/agno/tools/google/gmail.py:589-626 | libs/agno/agno/tools/google/gmail.py:819-849 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×13
  • Duplicated block (13 lines × 3) libs/agno/agno/agent/_run.py:1477 — libs/agno/agno/agent/_run.py:1477-1489 | libs/agno/agno/team/_run.py:4284-4296 | libs/agno/agno/team/_run.py:4316-4328 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (13 lines × 3) libs/agno/agno/agent/_storage.py:574 — libs/agno/agno/agent/_storage.py:574-586 | libs/agno/agno/team/_storage.py:475-487 | libs/agno/agno/workflow/workflow.py:2506-2518 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `session` to `AgentSession` in one and `TeamSession` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 3) libs/agno/agno/db/base.py:487 — libs/agno/agno/db/base.py:487-499 | libs/agno/agno/db/postgres/postgres.py:310-322 | REDACTED:308-320 — before extracting anything, compare `libs/agno/agno/db/base.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:83 — libs/agno/agno/db/gcs_json/gcs_json_db.py:83-95 | libs/agno/agno/db/redis/redis.py:104-116 | libs/agno/agno/db/surrealdb/surrealdb.py:108-120 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/redis/redis.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) libs/agno/agno/knowledge/embedder/aws_bedrock.py:477 — libs/agno/agno/knowledge/embedder/aws_bedrock.py:477-489 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:529-541 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:561-573 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 3) libs/agno/agno/os/routers/components/components.py:1301 — libs/agno/agno/os/routers/components/components.py:1301-1313 | libs/agno/agno/os/routers/components/components.py:1411-1423 | libs/agno/agno/os/routers/components/components.py:1479-1491 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) libs/agno/agno/workflow/condition.py:1035 — libs/agno/agno/workflow/condition.py:1035-1047 | libs/agno/agno/workflow/router.py:707-719 | libs/agno/agno/workflow/router.py:1041-1053 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:1035` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 3) libs/agno_infra/agno/aws/resources.py:97 — libs/agno_infra/agno/aws/resources.py:97-109 | libs/agno_infra/agno/aws/resources.py:259-271 | libs/agno_infra/agno/aws/resources.py:416-428 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resources.py:97` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) libs/agno_infra/agno/docker/resources.py:41 — libs/agno_infra/agno/docker/resources.py:41-53 | libs/agno_infra/agno/docker/resources.py:200-212 | libs/agno_infra/agno/docker/resources.py:365-377 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) libs/agno_infra/agno/docker/resources.py:55 — libs/agno_infra/agno/docker/resources.py:55-67 | libs/agno_infra/agno/docker/resources.py:214-226 | libs/agno_infra/agno/docker/resources.py:379-391 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/docker/resources.py:55` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) libs/agno_infra/agno/docker/resources.py:153 — libs/agno_infra/agno/docker/resources.py:153-165 | libs/agno_infra/agno/docker/resources.py:319-331 | libs/agno_infra/agno/docker/resources.py:475-487 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno_infra/agno/docker/resources.py:474` calls `print_info` and `libs/agno_infra/agno/docker/resources.py:152` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 3) libs/agno/agno/cloud/aws/base.py:102 — libs/agno/agno/cloud/aws/base.py:102-114 | libs/agno_infra/agno/aws/resource/base.py:90-102 | libs/agno_infra/agno/docker/resource/base.py:39-51 — before extracting anything, compare `libs/agno_infra/agno/aws/resource/base.py` and `libs/agno_infra/agno/docker/resource/base.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `AwsApiClient` names `agno.aws.api_client` in one and `agno.cloud.aws.s3.api_client` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 3) libs/agno/agno/knowledge/loaders/azure_blob.py:33 — libs/agno/agno/knowledge/loaders/azure_blob.py:33-45 | libs/agno/agno/knowledge/loaders/github.py:203-215 | libs/agno/agno/knowledge/loaders/sharepoint.py:35-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×13
  • Duplicated block (8 lines × 4) libs/agno/agno/db/dynamo/dynamo.py:2970 — libs/agno/agno/db/dynamo/dynamo.py:2970-2977 | libs/agno/agno/db/firestore/firestore.py:2541-2548 | libs/agno/agno/db/redis/redis.py:2296-2303 | libs/agno/agno/db/valkey/valkey.py:2791-2798 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/redis/redis.py:2308` calls `apply_pagination` and `libs/agno/agno/db/dynamo/dynamo.py:2980` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) REDACTED:1903 — REDACTED:1903-1910 | REDACTED:1996-2003 | REDACTED:2089-2096 | REDACTED:2155-2162 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1912` calls `_get_all_records` and `REDACTED:2098` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) libs/agno/agno/db/mysql/mysql.py:3250 — libs/agno/agno/db/mysql/mysql.py:3250-3257 | libs/agno/agno/db/postgres/postgres.py:4315-4322 | libs/agno/agno/db/singlestore/singlestore.py:3202-3209 | REDACTED:4106-4113 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4483 — libs/agno/agno/db/postgres/async_postgres.py:4483-4490 | libs/agno/agno/db/postgres/postgres.py:7206-7213 | REDACTED:4556-4563 | REDACTED:6974-6981 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6820 — libs/agno/agno/db/postgres/async_postgres.py:6820-6827 | libs/agno/agno/db/postgres/postgres.py:9559-9566 | REDACTED:5989-5996 | REDACTED:8488-8495 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6820` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) libs/agno/agno/db/postgres/postgres.py:7970 — libs/agno/agno/db/postgres/postgres.py:7970-7979 | libs/agno/agno/db/postgres/postgres.py:8061-8068 | libs/agno/agno/db/postgres/postgres.py:8091-8098 | libs/agno/agno/db/postgres/postgres.py:8169-8178 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:7970` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 4) libs/agno/agno/knowledge/embedder/aws_bedrock.py:477 — libs/agno/agno/knowledge/embedder/aws_bedrock.py:477-484 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:499-506 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:529-536 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:561-568 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 4) libs/agno/agno/media/media.py:262 — libs/agno/agno/media/media.py:262-269 | libs/agno/agno/media/media.py:423-430 | libs/agno/agno/media/media.py:600-607 | libs/agno/agno/media/media.py:856-863 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/media/media.py:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) libs/agno/agno/models/ibm/watsonx.py:146 — libs/agno/agno/models/ibm/watsonx.py:146-153 | libs/agno/agno/models/ollama/chat.py:206-213 | libs/agno/agno/utils/models/ai_foundry.py:41-48 | libs/agno/agno/utils/models/mistral.py:62-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (8 lines × 4) libs/agno/agno/os/authz/native_engine.py:454 — libs/agno/agno/os/authz/native_engine.py:454-461 | libs/agno/agno/os/authz/native_engine.py:484-497 | libs/agno/agno/os/authz/native_engine.py:736-743 | libs/agno/agno/os/authz/native_engine.py:762-769 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 4) libs/agno/agno/utils/agent.py:1097 — libs/agno/agno/utils/agent.py:1097-1104 | libs/agno/agno/utils/agent.py:1123-1130 | libs/agno/agno/workflow/workflow.py:1089-1096 | libs/agno/agno/workflow/workflow.py:1117-1124 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 4) libs/agno/agno/workflow/condition.py:214 — libs/agno/agno/workflow/condition.py:214-221 | libs/agno/agno/workflow/parallel.py:120-127 | libs/agno/agno/workflow/router.py:256-263 | libs/agno/agno/workflow/steps.py:129-136 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
  • Duplicated block (8 lines × 4) cookbook/07_knowledge/09_archive/vector_dbs/lance_db.py:77 — cookbook/07_knowledge/09_archive/vector_dbs/lance_db.py:77-84 | cookbook/07_knowledge/09_archive/vector_dbs/pinecone_db.py:90-97 | cookbook/07_knowledge/09_archive/vector_dbs/singlestore_db.py:101-108 | cookbook/07_knowledge/09_archive/vector_dbs/upstash_db.py:84-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×12
  • Duplicated block (38 lines × 2) cookbook/02_agents/14_advanced/background_execution.py:48 — cookbook/02_agents/14_advanced/background_execution.py:48-85 | cookbook/03_teams/14_run_control/background_execution.py:62-99 — before extracting anything, compare `cookbook/02_agents/14_advanced/background_execution.py` and `cookbook/03_teams/14_run_control/background_execution.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/14_advanced/background_execution.py:48` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (38 lines × 2) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:84 — cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:84-121 | cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:84-121 — before extracting anything, compare `cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py` and `cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (38 lines × 2) libs/agno/agno/agent/_storage.py:669 — libs/agno/agno/agent/_storage.py:669-706 | libs/agno/agno/agent/_storage.py:741-778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_storage.py:738` calls `has_async_db`, `cast`, `aread_session` and `libs/agno/agno/agent/_storage.py:667` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (38 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1186 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1186-1223 | libs/agno/agno/db/json/json_db.py:1255-1292 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (38 lines × 2) libs/agno/agno/db/redis/redis.py:1906 — libs/agno/agno/db/redis/redis.py:1906-1943 | libs/agno/agno/db/valkey/valkey.py:2340-2377 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (38 lines × 2) libs/agno/agno/os/routers/agents/router.py:1825 — libs/agno/agno/os/routers/agents/router.py:1825-1862 | libs/agno/agno/os/routers/teams/router.py:1760-1797 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1825` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (38 lines × 2) libs/agno/agno/team/_run.py:729 — libs/agno/agno/team/_run.py:729-766 | libs/agno/agno/team/_run.py:2661-2698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (38 lines × 2) libs/agno/agno/team/_run.py:2149 — libs/agno/agno/team/_run.py:2149-2186 | libs/agno/agno/team/_run.py:2531-2568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (38 lines × 2) libs/agno/agno/team/_storage.py:339 — libs/agno/agno/team/_storage.py:339-376 | libs/agno/agno/team/_storage.py:413-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_storage.py:410` calls `_has_async_db`, `cast`, `_aread_session` and `libs/agno/agno/team/_storage.py:338` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (38 lines × 2) libs/agno/agno/tools/scheduler.py:615 — libs/agno/agno/tools/scheduler.py:615-652 | libs/agno/agno/tools/scheduler.py:1004-1041 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (38 lines × 2) libs/agno/agno/workflow/parallel.py:355 — libs/agno/agno/workflow/parallel.py:355-392 | libs/agno/agno/workflow/parallel.py:723-760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/parallel.py:355` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (38 lines × 2) libs/agno/agno/workflow/step.py:1439 — libs/agno/agno/workflow/step.py:1439-1476 | libs/agno/agno/workflow/step.py:2101-2138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (25–26 lines × 2) · ×12
  • Duplicated block (25–26 lines × 2) libs/agno/agno/agent/_cli.py:100 — libs/agno/agno/agent/_cli.py:100-125 | libs/agno/agno/team/_cli.py:119-143 — `libs/agno/agno/agent/_cli.py` and `libs/agno/agno/team/_cli.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_cli.py:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/agent/_hooks.py:311 — libs/agno/agno/agent/_hooks.py:311-336 | libs/agno/agno/agent/_hooks.py:415-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/agent/_run.py:1203 — libs/agno/agno/agent/_run.py:1203-1227 | libs/agno/agno/agent/_run.py:2563-2588 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/client/os.py:664 — libs/agno/agno/client/os.py:664-689 | libs/agno/agno/client/os.py:707-731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/context/calendar/provider.py:106 — libs/agno/agno/context/calendar/provider.py:106-130 | libs/agno/agno/context/gmail/provider.py:113-138 — `libs/agno/agno/context/calendar/provider.py` and `libs/agno/agno/context/gmail/provider.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 60 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2487 — libs/agno/agno/db/postgres/async_postgres.py:2487-2512 | REDACTED:2681-2705 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/db/postgres/postgres.py:477 — libs/agno/agno/db/postgres/postgres.py:477-502 | REDACTED:492-516 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/db/postgres/postgres.py:3016 — libs/agno/agno/db/postgres/postgres.py:3016-3041 | REDACTED:2933-2957 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/knowledge/knowledge.py:5603 — libs/agno/agno/knowledge/knowledge.py:5603-5628 | libs/agno/agno/knowledge/knowledge.py:5669-5693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/tools/gitlab.py:331 — libs/agno/agno/tools/gitlab.py:331-355 | libs/agno/agno/tools/gitlab.py:482-507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/workflow/workflow.py:3393 — libs/agno/agno/workflow/workflow.py:3393-3418 | libs/agno/agno/workflow/workflow.py:4423-4447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25–26 lines × 2) libs/agno/agno/workflow/workflow.py:7190 — libs/agno/agno/workflow/workflow.py:7190-7215 | libs/agno/agno/workflow/workflow.py:9249-9273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×12
  • Duplicated block (17–18 lines × 2) libs/agno/agno/agent/_messages.py:1153 — libs/agno/agno/agent/_messages.py:1153-1169 | libs/agno/agno/agent/_messages.py:1450-1467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1153` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_messages.py:1468` calls `getattr` and `libs/agno/agno/agent/_messages.py:1170` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/agent/_run.py:4560 — libs/agno/agno/agent/_run.py:4560-4577 | libs/agno/agno/team/_run.py:8888-8904 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/agent/_tools.py:564 — libs/agno/agno/agent/_tools.py:564-581 | libs/agno/agno/team/_tools.py:424-440 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) REDACTED:828 — REDACTED:828-844 | REDACTED:1045-1062 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1823 — libs/agno/agno/db/mongo/async_mongo.py:1823-1839 | libs/agno/agno/db/mongo/mongo.py:1627-1644 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1823` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1897 — libs/agno/agno/db/mongo/async_mongo.py:1897-1913 | libs/agno/agno/db/mongo/mongo.py:1703-1720 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1897` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5623 — libs/agno/agno/db/postgres/async_postgres.py:5623-5640 | libs/agno/agno/db/postgres/postgres.py:8305-8321 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5623` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/os/routers/agents/router.py:381 — libs/agno/agno/os/routers/agents/router.py:381-398 | libs/agno/agno/os/routers/agents/router.py:464-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/team/_run.py:5526 — libs/agno/agno/team/_run.py:5526-5542 | libs/agno/agno/team/_run.py:5605-5622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/tools/mem0.py:136 — libs/agno/agno/tools/mem0.py:136-153 | libs/agno/agno/tools/mem0.py:163-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/mem0.py:136` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) REDACTED:329 — REDACTED:329-345 | REDACTED:431-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) libs/agno/agno/workflow/workflow.py:4666 — libs/agno/agno/workflow/workflow.py:4666-4683 | libs/agno/agno/workflow/workflow.py:4709-4725 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:4666` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×12
  • Duplicated block (16–17 lines × 2) libs/agno/agno/db/mongo/mongo.py:2957 — libs/agno/agno/db/mongo/mongo.py:2957-2973 | libs/agno/agno/db/mongo/mongo.py:3270-3285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5219 — libs/agno/agno/db/postgres/async_postgres.py:5219-5235 | libs/agno/agno/db/postgres/postgres.py:7918-7933 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5219` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/db/postgres/postgres.py:3158 — libs/agno/agno/db/postgres/postgres.py:3158-3174 | libs/agno/agno/db/singlestore/singlestore.py:2277-2292 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/singlestore/singlestore.py:2294` calls `log_debug` and `libs/agno/agno/db/postgres/postgres.py:3176` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/db/valkey/valkey.py:754 — libs/agno/agno/db/valkey/valkey.py:754-770 | libs/agno/agno/db/valkey/valkey.py:2190-2205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/knowledge/knowledge.py:2633 — libs/agno/agno/knowledge/knowledge.py:2633-2648 | libs/agno/agno/knowledge/knowledge.py:2819-2835 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/knowledge/knowledge.py:2709 — libs/agno/agno/knowledge/knowledge.py:2709-2725 | libs/agno/agno/knowledge/knowledge.py:2893-2908 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/knowledge.py:2709` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/team/_messages.py:577 — libs/agno/agno/team/_messages.py:577-592 | libs/agno/agno/team/_messages.py:827-843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_messages.py:577` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_messages.py:844` calls `getattr` and `libs/agno/agno/team/_messages.py:593` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/team/_run.py:963 — libs/agno/agno/team/_run.py:963-978 | libs/agno/agno/team/_run.py:1759-1775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:963` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/team/_task_tools.py:898 — libs/agno/agno/team/_task_tools.py:898-914 | libs/agno/agno/team/_task_tools.py:1104-1119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/tools/parallel.py:510 — libs/agno/agno/tools/parallel.py:510-526 | libs/agno/agno/tools/parallel.py:558-573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) REDACTED:1059 — REDACTED:1059-1074 | REDACTED:1098-1114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 2) libs/agno/agno/workflow/workflow.py:5897 — libs/agno/agno/workflow/workflow.py:5897-5913 | libs/agno/agno/workflow/workflow.py:6311-6326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5897` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:6310` calls `_broadcast_to_websocket` and `libs/agno/agno/workflow/workflow.py:5897` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×12
  • Duplicated block (14 lines × 4) cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:110 — cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:110-123 | cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py:85-98 | cookbook/07_knowledge/09_archive/vector_dbs/mongo_db.py:114-127 | cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py:95-108 — before extracting anything, compare `cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py` and `cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:105` calls `delete_by_name`, `delete_by_metadata` and `cookbook/07_knowledge/09_archive/vector_dbs/mongo_db.py:110` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 4) libs/agno/agno/agent/_messages.py:1589 — libs/agno/agno/agent/_messages.py:1589-1602 | libs/agno/agno/agent/_messages.py:1759-1772 | libs/agno/agno/team/_messages.py:1263-1276 | libs/agno/agno/team/_messages.py:1422-1435 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1589` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 4) libs/agno/agno/db/mongo/async_mongo.py:2815 — libs/agno/agno/db/mongo/async_mongo.py:2815-2828 | libs/agno/agno/db/mongo/async_mongo.py:2906-2919 | libs/agno/agno/db/mongo/mongo.py:2679-2692 | libs/agno/agno/db/mongo/mongo.py:2770-2783 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:206 — libs/agno/agno/db/postgres/async_postgres.py:206-219 | libs/agno/agno/db/postgres/postgres.py:239-252 | REDACTED:143-156 | REDACTED:185-198 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:206` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4430 — libs/agno/agno/db/postgres/async_postgres.py:4430-4443 | libs/agno/agno/db/postgres/async_postgres.py:4760-4773 | REDACTED:4503-4516 | REDACTED:4850-4863 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4697 — libs/agno/agno/db/postgres/async_postgres.py:4697-4710 | libs/agno/agno/db/postgres/postgres.py:7446-7459 | REDACTED:4787-4800 | REDACTED:7231-7244 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 4) libs/agno/agno/os/interfaces/a2a/router.py:366 — libs/agno/agno/os/interfaces/a2a/router.py:366-379 | libs/agno/agno/os/interfaces/a2a/router.py:693-706 | libs/agno/agno/os/interfaces/a2a/router.py:811-824 | libs/agno/agno/os/interfaces/a2a/router.py:904-917 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (14 lines × 4) libs/agno/agno/os/routers/agents/router.py:615 — libs/agno/agno/os/routers/agents/router.py:615-628 | libs/agno/agno/os/routers/teams/router.py:379-392 | libs/agno/agno/os/routers/workflows/router.py:1558-1571 | libs/agno/agno/os/utils.py:443-456 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (14 lines × 4) libs/agno/agno/team/_run.py:9597 — libs/agno/agno/team/_run.py:9597-9610 | libs/agno/agno/team/_run.py:9646-9659 | libs/agno/agno/team/_run.py:10083-10096 | libs/agno/agno/team/_run.py:10212-10225 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:9597` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 4) libs/agno/agno/tools/scheduler.py:737 — libs/agno/agno/tools/scheduler.py:737-752 | libs/agno/agno/tools/scheduler.py:973-986 | libs/agno/agno/tools/scheduler.py:1126-1141 | libs/agno/agno/tools/scheduler.py:1368-1381 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 4) libs/agno/agno/tools/whatsapp.py:178 — libs/agno/agno/tools/whatsapp.py:178-191 | libs/agno/agno/tools/whatsapp.py:353-366 | libs/agno/agno/tools/whatsapp.py:404-417 | libs/agno/agno/tools/whatsapp.py:451-464 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 4) libs/agno_infra/agno/aws/resource/elb/listener.py:209 — libs/agno_infra/agno/aws/resource/elb/listener.py:209-222 | libs/agno_infra/agno/aws/resource/elb/target_group.py:200-213 | libs/agno_infra/agno/aws/resource/rds/db_cluster.py:743-756 | libs/agno_infra/agno/aws/resource/rds/db_instance.py:685-698 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resource/elb/listener.py:209` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×12
  • Duplicated block (14 lines × 3) cookbook/02_agents/14_advanced/background_execution.py:65 — cookbook/02_agents/14_advanced/background_execution.py:65-78 | cookbook/02_agents/14_advanced/background_execution_structured.py:80-93 | cookbook/03_teams/14_run_control/background_execution.py:79-92 — before extracting anything, compare `cookbook/02_agents/14_advanced/background_execution.py` and `cookbook/03_teams/14_run_control/background_execution.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) cookbook/02_agents/20_time_travel/01_continue_from.py:52 — cookbook/02_agents/20_time_travel/01_continue_from.py:52-65 | cookbook/02_agents/20_time_travel/01_continue_from.py:66-79 | cookbook/02_agents/20_time_travel/02_fork_run.py:57-70 — before extracting anything, compare `cookbook/02_agents/20_time_travel/01_continue_from.py` and `cookbook/02_agents/20_time_travel/02_fork_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 3) cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:70 — cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:70-83 | cookbook/05_agent_os/05_human_in_the_loop/basic.py:66-79 | cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py:85-98 — before extracting anything, compare `cookbook/05_agent_os/05_human_in_the_loop/basic.py` and `cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/05_agent_os/05_human_in_the_loop/basic.py:83` calls `RuntimeError` and `cookbook/05_agent_os/05_human_in_the_loop/audit_record.py:86` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:921 — libs/agno/agno/db/gcs_json/gcs_json_db.py:921-934 | libs/agno/agno/db/in_memory/in_memory_db.py:760-773 | libs/agno/agno/db/json/json_db.py:988-1001 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) libs/agno/agno/db/postgres/postgres.py:903 — libs/agno/agno/db/postgres/postgres.py:903-916 | libs/agno/agno/db/singlestore/singlestore.py:538-551 | REDACTED:891-904 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) libs/agno/agno/learn/stores/session_context.py:552 — libs/agno/agno/learn/stores/session_context.py:552-571 | libs/agno/agno/learn/stores/user_memory.py:777-790 | libs/agno/agno/learn/stores/user_profile.py:865-878 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/session_context.py:552` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/learn/stores/user_memory.py:775` calls `_build_functions_for_model` and `libs/agno/agno/learn/stores/session_context.py:552` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 3) libs/agno/agno/learn/stores/session_context.py:622 — libs/agno/agno/learn/stores/session_context.py:622-641 | libs/agno/agno/learn/stores/user_memory.py:840-853 | libs/agno/agno/learn/stores/user_profile.py:925-938 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/session_context.py:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/learn/stores/user_memory.py:838` calls `_build_functions_for_model` and `libs/agno/agno/learn/stores/session_context.py:622` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:148 — libs/agno/agno/os/interfaces/a2a/router.py:148-161 | libs/agno/agno/os/interfaces/a2a/router.py:479-492 | libs/agno/agno/os/interfaces/a2a/router.py:806-819 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:148` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/interfaces/a2a/router.py:166` calls `get` and `libs/agno/agno/os/interfaces/a2a/router.py:824` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 3) libs/agno/agno/os/routers/agents/router.py:1886 — libs/agno/agno/os/routers/agents/router.py:1886-1900 | libs/agno/agno/os/routers/agents/router.py:2002-2015 | libs/agno/agno/os/routers/teams/router.py:1821-1835 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1886` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) libs/agno/agno/tools/studio_runner.py:2711 — libs/agno/agno/tools/studio_runner.py:2711-2724 | libs/agno/agno/tools/studio_runner.py:2777-2790 | libs/agno/agno/tools/studio_runner.py:2843-2856 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio_runner.py:2711` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) libs/agno/agno/vectordb/redis/redisdb.py:826 — libs/agno/agno/vectordb/redis/redisdb.py:826-839 | libs/agno/agno/vectordb/redis/redisdb.py:864-877 | libs/agno/agno/vectordb/redis/redisdb.py:901-914 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (14 lines × 3) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:271 — libs/agno_infra/agno/aws/resource/elasticache/cluster.py:271-284 | libs/agno_infra/agno/aws/resource/rds/db_cluster.py:543-556 | libs/agno_infra/agno/aws/resource/rds/db_instance.py:464-477 — before extracting anything, compare `libs/agno_infra/agno/aws/resource/rds/db_cluster.py` and `libs/agno_infra/agno/aws/resource/rds/db_instance.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×11
  • Duplicated block (35 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:2005 — libs/agno/agno/db/gcs_json/gcs_json_db.py:2005-2039 | libs/agno/agno/db/json/json_db.py:2100-2134 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1780 — libs/agno/agno/db/mongo/async_mongo.py:1780-1814 | libs/agno/agno/db/mongo/mongo.py:1585-1619 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1780` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/db/mysql/mysql.py:898 — libs/agno/agno/db/mysql/mysql.py:898-932 | libs/agno/agno/db/singlestore/singlestore.py:952-986 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5015 — libs/agno/agno/db/postgres/async_postgres.py:5015-5049 | libs/agno/agno/db/postgres/postgres.py:7719-7753 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6804 — libs/agno/agno/db/postgres/async_postgres.py:6804-6838 | REDACTED:5973-6007 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/db/postgres/postgres.py:9918 — libs/agno/agno/db/postgres/postgres.py:9918-9952 | REDACTED:8847-8881 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:9918` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/eval/accuracy.py:368 — libs/agno/agno/eval/accuracy.py:368-402 | libs/agno/agno/eval/accuracy.py:510-544 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/eval/accuracy.py:365` calls `isinstance`, `ValueError` and `libs/agno/agno/eval/accuracy.py:509` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (35 lines × 2) REDACTED:1381 — REDACTED:1381-1415 | REDACTED:1662-1696 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/team/_task_tools.py:362 — libs/agno/agno/team/_task_tools.py:362-396 | libs/agno/agno/team/_task_tools.py:429-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 2) libs/agno/agno/workflow/workflow.py:3738 — libs/agno/agno/workflow/workflow.py:3738-3772 | libs/agno/agno/workflow/workflow.py:4783-4817 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:4822` calls `isinstance`, `_persist_cancelled_run_in_background` and `libs/agno/agno/workflow/workflow.py:3774` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (35 lines × 2) libs/agno/agno/db/mysql/schemas.py:190 — libs/agno/agno/db/mysql/schemas.py:190-224 | libs/agno/agno/db/singlestore/schemas.py:192-226 — `libs/agno/agno/db/mysql/schemas.py` and `libs/agno/agno/db/singlestore/schemas.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 35 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×11
  • Duplicated block (24–25 lines × 2) cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:142 — cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:142-166 | cookbook/03_teams/23_checkpointing/02_tool_error_persistence.py:125-148 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/agent/_response.py:1621 — libs/agno/agno/agent/_response.py:1621-1645 | libs/agno/agno/team/_response.py:1574-1597 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3669 — libs/agno/agno/db/mongo/async_mongo.py:3669-3693 | libs/agno/agno/db/mongo/mongo.py:3474-3497 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/db/postgres/postgres.py:6100 — libs/agno/agno/db/postgres/postgres.py:6100-6124 | REDACTED:5890-5913 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:6100` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/os/routers/agents/router.py:1456 — libs/agno/agno/os/routers/agents/router.py:1456-1480 | libs/agno/agno/os/routers/teams/router.py:1419-1442 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1456` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/team/_run.py:1840 — libs/agno/agno/team/_run.py:1840-1863 | libs/agno/agno/team/_run.py:8597-8621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/team/_run.py:2439 — libs/agno/agno/team/_run.py:2439-2462 | libs/agno/agno/team/_run.py:3377-3401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/tools/reasoning.py:80 — libs/agno/agno/tools/reasoning.py:80-104 | libs/agno/agno/tools/reasoning.py:153-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/reasoning.py:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24–25 lines × 2) REDACTED:1152 — REDACTED:1152-1175 | REDACTED:1454-1478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/workflow/loop.py:656 — libs/agno/agno/workflow/loop.py:656-680 | libs/agno/agno/workflow/steps.py:433-456 — before extracting anything, compare `libs/agno/agno/workflow/loop.py` and `libs/agno/agno/workflow/steps.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 197 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:656` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24–25 lines × 2) libs/agno/agno/workflow/loop.py:1053 — libs/agno/agno/workflow/loop.py:1053-1077 | libs/agno/agno/workflow/steps.py:738-761 — before extracting anything, compare `libs/agno/agno/workflow/loop.py` and `libs/agno/agno/workflow/steps.py` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 197 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:1053` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×11
  • Duplicated block (19–20 lines × 2) libs/agno/agno/agent/_hooks.py:342 — libs/agno/agno/agent/_hooks.py:342-360 | libs/agno/agno/agent/_hooks.py:442-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/agent/_response.py:491 — libs/agno/agno/agent/_response.py:491-510 | libs/agno/agno/agent/_response.py:561-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/agent/_run.py:1931 — libs/agno/agno/agent/_run.py:1931-1949 | libs/agno/agno/agent/_run.py:2686-2705 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1931` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5185 — libs/agno/agno/db/postgres/async_postgres.py:5185-5203 | libs/agno/agno/db/postgres/postgres.py:7884-7903 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/knowledge/knowledge.py:1214 — libs/agno/agno/knowledge/knowledge.py:1214-1233 | libs/agno/agno/knowledge/knowledge.py:1280-1298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/knowledge/knowledge.py:1299` calls `_search_limit` and `libs/agno/agno/knowledge/knowledge.py:1236` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:226 — libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:226-244 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:259-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/os/routers/evals/evals.py:488 — libs/agno/agno/os/routers/evals/evals.py:488-506 | libs/agno/agno/os/routers/evals/evals.py:514-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/evals/evals.py:485` calls `log_warning`, `isinstance` and `libs/agno/agno/os/routers/evals/evals.py:513` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/team/_default_tools.py:716 — libs/agno/agno/team/_default_tools.py:716-735 | libs/agno/agno/team/_default_tools.py:1073-1091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:716` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/team/_hooks.py:514 — libs/agno/agno/team/_hooks.py:514-533 | libs/agno/agno/team/_hooks.py:615-633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_hooks.py:612` calls `iscoroutinefunction`, `hook` and `libs/agno/agno/team/_hooks.py:512` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/team/_task_tools.py:607 — libs/agno/agno/team/_task_tools.py:607-626 | libs/agno/agno/team/_task_tools.py:793-811 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_task_tools.py:607` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–20 lines × 2) libs/agno/agno/workflow/workflow.py:3468 — libs/agno/agno/workflow/workflow.py:3468-3487 | libs/agno/agno/workflow/workflow.py:4510-4528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3468` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 4) · ×11
  • Duplicated block (16 lines × 4) libs/agno/agno/agent/_messages.py:1035 — libs/agno/agno/agent/_messages.py:1035-1050 | libs/agno/agno/agent/_messages.py:1332-1347 | libs/agno/agno/team/_messages.py:544-559 | libs/agno/agno/team/_messages.py:798-813 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1035` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 4) libs/agno/agno/agent/_run.py:1431 — libs/agno/agno/agent/_run.py:1431-1446 | libs/agno/agno/agent/_run.py:2823-2838 | libs/agno/agno/team/_run.py:2029-2044 | libs/agno/agno/team/_run.py:4229-4244 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1431` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 4) libs/agno/agno/db/mysql/mysql.py:194 — libs/agno/agno/db/mysql/mysql.py:194-209 | libs/agno/agno/db/postgres/postgres.py:408-423 | libs/agno/agno/db/singlestore/singlestore.py:261-276 | REDACTED:415-430 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 4) libs/agno/agno/db/mysql/mysql.py:2371 — libs/agno/agno/db/mysql/mysql.py:2371-2389 | libs/agno/agno/db/postgres/postgres.py:3289-3304 | libs/agno/agno/db/singlestore/singlestore.py:2395-2410 | REDACTED:3198-3213 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4780 — libs/agno/agno/db/postgres/async_postgres.py:4780-4795 | libs/agno/agno/db/postgres/postgres.py:7525-7540 | REDACTED:4870-4885 | REDACTED:7310-7325 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 4) libs/agno/agno/knowledge/embedder/google.py:74 — libs/agno/agno/knowledge/embedder/google.py:74-89 | libs/agno/agno/knowledge/embedder/google.py:130-145 | libs/agno/agno/knowledge/embedder/google.py:161-176 | libs/agno/agno/knowledge/embedder/google.py:213-228 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (16 lines × 4) libs/agno/agno/session/agent.py:247 — libs/agno/agno/session/agent.py:247-262 | libs/agno/agno/session/team.py:258-273 | libs/agno/agno/session/workflow.py:318-333 | libs/agno/agno/session/workflow.py:430-445 — before extracting anything, compare `libs/agno/agno/session/agent.py` and `libs/agno/agno/session/team.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 4) libs/agno/agno/team/_run.py:2698 — libs/agno/agno/team/_run.py:2698-2713 | libs/agno/agno/team/_run.py:3829-3844 | libs/agno/agno/team/_run.py:10136-10151 | libs/agno/agno/team/_run.py:10256-10271 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (16 lines × 4) libs/agno/agno/vectordb/surrealdb/surrealdb.py:401 — libs/agno/agno/vectordb/surrealdb/surrealdb.py:401-416 | libs/agno/agno/vectordb/surrealdb/surrealdb.py:445-460 | libs/agno/agno/vectordb/surrealdb/surrealdb.py:779-794 | libs/agno/agno/vectordb/surrealdb/surrealdb.py:823-838 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/vectordb/surrealdb/surrealdb.py:839` calls `log_debug` and `libs/agno/agno/vectordb/surrealdb/surrealdb.py:461` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 4) libs/agno/agno/workflow/step.py:1115 — libs/agno/agno/workflow/step.py:1115-1130 | libs/agno/agno/workflow/step.py:1442-1457 | libs/agno/agno/workflow/step.py:1799-1814 | libs/agno/agno/workflow/step.py:2104-2119 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/step.py:1795` calls `log_debug` and `libs/agno/agno/workflow/step.py:1110` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 4) libs/agno/agno/workflow/step.py:2872 — libs/agno/agno/workflow/step.py:2872-2887 | libs/agno/agno/workflow/step.py:2993-3008 | libs/agno/agno/workflow/step.py:3149-3164 | libs/agno/agno/workflow/step.py:3270-3285 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×11
  • Duplicated block (11–13 lines × 2) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:188 — cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:188-198 | cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:171-183 — before extracting anything, compare `cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py` and `cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/agent/_init.py:519 — libs/agno/agno/agent/_init.py:519-529 | libs/agno/agno/team/_init.py:930-942 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `tools` to `Union[Sequence[Union[Toolkit, Callable, Function, Dict]], Callable]` in one and `Union[List[Union[Toolkit, Callable, Function, Dict]], Callable[..., List]]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:396 — libs/agno/agno/db/gcs_json/gcs_json_db.py:396-406 | libs/agno/agno/db/json/json_db.py:441-453 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/db/postgres/postgres.py:5539 — libs/agno/agno/db/postgres/postgres.py:5539-5551 | REDACTED:5336-5346 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/db/sql/authz.py:339 — libs/agno/agno/db/sql/authz.py:339-351 | libs/agno/agno/db/sql/authz.py:761-771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/memory/manager.py:405 — libs/agno/agno/memory/manager.py:405-415 | libs/agno/agno/memory/manager.py:498-510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/metrics.py:733 — libs/agno/agno/metrics.py:733-745 | libs/agno/agno/metrics.py:810-820 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/team/_hooks.py:100 — libs/agno/agno/team/_hooks.py:100-112 | libs/agno/agno/team/_hooks.py:137-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) libs/agno/agno/team/_messages.py:1677 — libs/agno/agno/team/_messages.py:1677-1687 | libs/agno/agno/utils/prompts.py:30-42 — before extracting anything, compare `libs/agno/agno/team/_messages.py` and `libs/agno/agno/utils/prompts.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/prompts.py:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–13 lines × 2) REDACTED:118 — REDACTED:118-130 | REDACTED:85-95 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–13 lines × 2) libs/agno_infra/agno/infra/config.py:199 — libs/agno_infra/agno/infra/config.py:199-209 | libs/agno_infra/agno/infra/config.py:286-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/infra/config.py:286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno_infra/agno/infra/config.py:197` calls `debug` and `libs/agno_infra/agno/infra/config.py:286` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×10
  • Members sharing a duplicated core (5 members, 50+ identical tokens) cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:25 — cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:25-47 | cookbook/02_agents/10_human_in_the_loop/confirmation_required.py:25-47 | cookbook/91_tools/python_function_as_tool.py:19-42 | cookbook/91_tools/tool_calls_accesing_agent.py:19-35 | cookbook/91_tools/tool_decorator/cache_tool_calls.py:22-36 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/agent/_storage.py:614 — libs/agno/agno/agent/_storage.py:614-635 | libs/agno/agno/team/_storage.py:172-193 | libs/agno/agno/utils/agent.py:1138-1166 | libs/agno/agno/utils/agent.py:1170-1194 | libs/agno/agno/workflow/workflow.py:11352-11373 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/db/gcs_json/gcs_json_db.py:846 — libs/agno/agno/db/gcs_json/gcs_json_db.py:846-867 | libs/agno/agno/db/in_memory/in_memory_db.py:684-707 | libs/agno/agno/db/json/json_db.py:909-931 | libs/agno/agno/db/redis/redis.py:1072-1095 | libs/agno/agno/db/valkey/valkey.py:1366-1389 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) REDACTED:453 — REDACTED:453-489 | REDACTED:882-926 | REDACTED:1088-1128 | REDACTED:3662-3731 | REDACTED:4466-4528 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:795 — libs/agno/agno/db/mysql/async_mysql.py:795-827 | libs/agno/agno/db/mysql/mysql.py:786-824 | libs/agno/agno/db/singlestore/singlestore.py:842-880 | REDACTED:1093-1129 | REDACTED:1277-1316 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/tools/shopify.py:359 — libs/agno/agno/tools/shopify.py:359-454 | libs/agno/agno/tools/shopify.py:463-551 | libs/agno/agno/tools/shopify.py:782-925 | libs/agno/agno/tools/shopify.py:1315-1411 | libs/agno/agno/tools/shopify.py:1420-1519 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/tools/visualization.py:103 — libs/agno/agno/tools/visualization.py:103-165 | libs/agno/agno/tools/visualization.py:175-238 | libs/agno/agno/tools/visualization.py:246-303 | libs/agno/agno/tools/visualization.py:318-392 | libs/agno/agno/tools/visualization.py:403-467 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) REDACTED:1749 — REDACTED:1749-1762 | REDACTED:1765-1778 | REDACTED:1781-1794 | REDACTED:1797-1816 | REDACTED:1819-1845 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/workflow/condition.py:209 — libs/agno/agno/workflow/condition.py:209-289 | libs/agno/agno/workflow/loop.py:213-288 | libs/agno/agno/workflow/parallel.py:115-153 | libs/agno/agno/workflow/router.py:251-331 | libs/agno/agno/workflow/steps.py:124-170 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) libs/agno/agno/workflow/utils/hitl.py:464 — libs/agno/agno/workflow/utils/hitl.py:464-500 | libs/agno/agno/workflow/workflow.py:2938-3273 | libs/agno/agno/workflow/workflow.py:3287-3850 | libs/agno/agno/workflow/workflow.py:3928-4277 | libs/agno/agno/workflow/workflow.py:4292-4908 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×10
  • Duplicated block (17 lines × 3) libs/agno/agno/agent/_response.py:1675 — libs/agno/agno/agent/_response.py:1675-1691 | libs/agno/agno/agent/_tools.py:935-951 | libs/agno/agno/agent/_tools.py:1050-1066 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `agent` to `"Agent"` in one and `Agent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (17 lines × 3) libs/agno/agno/agent/_run.py:2666 — libs/agno/agno/agent/_run.py:2666-2682 | libs/agno/agno/agent/_run.py:5158-5174 | libs/agno/agno/agent/_run.py:5793-5809 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:237 — libs/agno/agno/db/mysql/async_mysql.py:237-253 | libs/agno/agno/db/mysql/mysql.py:232-248 | libs/agno/agno/db/postgres/async_postgres.py:407-423 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2305 — libs/agno/agno/db/mysql/async_mysql.py:2305-2321 | libs/agno/agno/db/postgres/async_postgres.py:2651-2667 | REDACTED:2849-2868 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2652 — libs/agno/agno/db/mysql/async_mysql.py:2652-2668 | libs/agno/agno/db/mysql/mysql.py:2621-2637 | libs/agno/agno/db/singlestore/singlestore.py:2617-2633 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 3) libs/agno/agno/db/postgres/postgres.py:2234 — libs/agno/agno/db/postgres/postgres.py:2234-2250 | libs/agno/agno/db/postgres/postgres.py:2292-2308 | libs/agno/agno/db/postgres/postgres.py:2350-2366 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 3) libs/agno/agno/os/middleware/user_scope.py:713 — libs/agno/agno/os/middleware/user_scope.py:713-729 | libs/agno/agno/os/middleware/user_scope.py:756-772 | libs/agno/agno/os/middleware/user_scope.py:799-815 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/middleware/user_scope.py:713` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 3) libs/agno/agno/os/routers/agents/schema.py:54 — libs/agno/agno/os/routers/agents/schema.py:54-70 | libs/agno/agno/os/routers/teams/schema.py:54-70 | libs/agno/agno/os/routers/workflows/schema.py:101-117 — `libs/agno/agno/os/routers/agents/schema.py` and `libs/agno/agno/os/routers/teams/schema.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 157 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `factory` to `AgentFactory` in one and `TeamFactory` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (17 lines × 3) libs/agno/agno/os/routers/components/components.py:778 — libs/agno/agno/os/routers/components/components.py:778-794 | libs/agno/agno/os/routers/components/components.py:1101-1117 | libs/agno/agno/os/routers/components/components.py:1421-1437 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/components/components.py:778` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/routers/components/components.py:1439` calls `Path`, `Body` and `libs/agno/agno/os/routers/components/components.py:1119` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 3) libs/agno/agno/learn/stores/session_context.py:422 — libs/agno/agno/learn/stores/session_context.py:422-438 | libs/agno/agno/learn/stores/user_memory.py:574-590 | libs/agno/agno/learn/stores/user_profile.py:742-758 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×10
  • Duplicated block (15 lines × 4) libs/agno/agno/agent/_messages.py:935 — libs/agno/agno/agent/_messages.py:935-949 | libs/agno/agno/agent/_messages.py:1231-1245 | libs/agno/agno/team/_messages.py:447-461 | libs/agno/agno/team/_messages.py:701-715 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 4) libs/agno/agno/db/mysql/mysql.py:3060 — libs/agno/agno/db/mysql/mysql.py:3060-3074 | libs/agno/agno/db/postgres/postgres.py:4032-4046 | libs/agno/agno/db/singlestore/singlestore.py:3000-3014 | REDACTED:3835-3849 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6839 — libs/agno/agno/db/postgres/async_postgres.py:6839-6853 | libs/agno/agno/db/postgres/postgres.py:9578-9592 | REDACTED:6008-6022 | REDACTED:8507-8521 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 4) libs/agno/agno/db/postgres/postgres.py:5019 — libs/agno/agno/db/postgres/postgres.py:5019-5033 | libs/agno/agno/db/postgres/postgres.py:6298-6312 | REDACTED:4859-4873 | REDACTED:6082-6096 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5019` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 4) libs/agno/agno/reasoning/deepseek.py:38 — libs/agno/agno/reasoning/deepseek.py:38-52 | libs/agno/agno/reasoning/groq.py:27-41 | libs/agno/agno/reasoning/moonshot.py:75-89 | libs/agno/agno/reasoning/openai.py:49-63 — before extracting anything, compare `libs/agno/agno/reasoning/deepseek.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 155 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 4) libs/agno/agno/reasoning/deepseek.py:117 — libs/agno/agno/reasoning/deepseek.py:117-131 | libs/agno/agno/reasoning/groq.py:65-79 | libs/agno/agno/reasoning/moonshot.py:110-124 | libs/agno/agno/reasoning/openai.py:88-102 — before extracting anything, compare `libs/agno/agno/reasoning/deepseek.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 155 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 4) libs/agno/agno/utils/print_response/team.py:189 — libs/agno/agno/utils/print_response/team.py:189-203 | libs/agno/agno/utils/print_response/team.py:600-614 | libs/agno/agno/utils/print_response/team.py:1125-1139 | libs/agno/agno/utils/print_response/team.py:1531-1545 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (15 lines × 4) libs/agno/agno/workflow/workflow.py:3619 — libs/agno/agno/workflow/workflow.py:3619-3633 | libs/agno/agno/workflow/workflow.py:4664-4678 | libs/agno/agno/workflow/workflow.py:7952-7966 | libs/agno/agno/workflow/workflow.py:9711-9725 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3619` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 4) libs/agno/agno/workflow/workflow.py:7518 — libs/agno/agno/workflow/workflow.py:7518-7532 | libs/agno/agno/workflow/workflow.py:7580-7594 | libs/agno/agno/workflow/workflow.py:7669-7683 | libs/agno/agno/workflow/workflow.py:7754-7768 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:7535` calls `_find_paused_executor_run` and `libs/agno/agno/workflow/workflow.py:7597` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 4) libs/agno/agno/knowledge/remote_content/gcs.py:20 — libs/agno/agno/knowledge/remote_content/gcs.py:20-34 | libs/agno/agno/knowledge/remote_content/gcs.py:37-51 | libs/agno/agno/knowledge/remote_content/s3.py:266-280 | libs/agno/agno/knowledge/remote_content/s3.py:283-297 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×10
  • Duplicated block (10–12 lines × 2) cookbook/02_agents/18_checkpointing/01_crash_recovery.py:154 — cookbook/02_agents/18_checkpointing/01_crash_recovery.py:154-165 | cookbook/03_teams/23_checkpointing/01_crash_recovery.py:152-161 — before extracting anything, compare `cookbook/02_agents/18_checkpointing/01_crash_recovery.py` and `cookbook/03_teams/23_checkpointing/01_crash_recovery.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10–12 lines × 2) cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:192 — cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:192-203 | cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:248-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/agent/agent.py:593 — libs/agno/agno/agent/agent.py:593-604 | libs/agno/agno/team/_init.py:242-251 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–12 lines × 2) REDACTED:454 — REDACTED:454-465 | REDACTED:4469-4478 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1941 — libs/agno/agno/db/mongo/async_mongo.py:1941-1952 | libs/agno/agno/db/mongo/mongo.py:1748-1757 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1941` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:960 — libs/agno/agno/db/postgres/async_postgres.py:960-971 | REDACTED:919-928 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:5367 — libs/agno/agno/db/postgres/async_postgres.py:5367-5376 | libs/agno/agno/db/postgres/async_postgres.py:5478-5489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/db/postgres/postgres.py:1112 — libs/agno/agno/db/postgres/postgres.py:1112-1123 | REDACTED:1105-1114 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/tools/studio.py:5130 — libs/agno/agno/tools/studio.py:5130-5141 | libs/agno/agno/tools/studio.py:5142-5151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–12 lines × 2) libs/agno/agno/workflow/workflow.py:2954 — libs/agno/agno/workflow/workflow.py:2954-2965 | libs/agno/agno/workflow/workflow.py:3312-3321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:2954` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×10
  • Duplicated block (9–11 lines × 2) libs/agno/agno/agent/_run.py:1985 — libs/agno/agno/agent/_run.py:1985-1995 | libs/agno/agno/agent/_run.py:2064-2072 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:262 — libs/agno/agno/db/mysql/async_mysql.py:262-270 | libs/agno/agno/db/postgres/async_postgres.py:444-454 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:444` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/db/postgres/postgres.py:8060 — libs/agno/agno/db/postgres/postgres.py:8060-8068 | libs/agno/agno/db/postgres/postgres.py:8168-8178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:8060` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/db/singlestore/singlestore.py:384 — libs/agno/agno/db/singlestore/singlestore.py:384-394 | REDACTED:565-573 — `libs/agno/agno/db/singlestore/singlestore.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 97 separate duplicated blocks between them, totalling at least 1641 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/models/aws/bedrock.py:633 — libs/agno/agno/models/aws/bedrock.py:633-643 | libs/agno/agno/models/aws/bedrock.py:734-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/aws/bedrock.py:633` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/os/routers/workflows/router.py:1222 — libs/agno/agno/os/routers/workflows/router.py:1222-1230 | libs/agno/agno/workflow/workflow.py:10425-10435 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/workflows/router.py:1222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/os/routers/workflows/router.py:1218 — libs/agno/agno/os/routers/workflows/router.py:1218-1226 | libs/agno/agno/workflow/workflow.py:5288-5298 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/team/_run.py:3480 — libs/agno/agno/team/_run.py:3480-3490 | libs/agno/agno/team/_run.py:3556-3564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–11 lines × 2) libs/agno/agno/tools/function.py:2274 — libs/agno/agno/tools/function.py:2274-2284 | libs/agno/agno/tools/function.py:2289-2297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–11 lines × 2) REDACTED:162 — REDACTED:162-172 | REDACTED:60-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:58` calls `super`, `__init__` and `REDACTED:161` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×10
  • Duplicated block (9–10 lines × 2) libs/agno/agno/agent/_response.py:1506 — libs/agno/agno/agent/_response.py:1506-1515 | libs/agno/agno/team/_response.py:1462-1470 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9–10 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:875 — libs/agno/agno/db/dynamo/dynamo.py:875-884 | libs/agno/agno/db/dynamo/dynamo.py:2820-2828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) libs/agno/agno/db/mongo/utils.py:61 — libs/agno/agno/db/mongo/utils.py:61-70 | libs/agno/agno/db/mongo/utils.py:106-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `collection` to `Collection` in one and `Any` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9–10 lines × 2) libs/agno/agno/knowledge/knowledge.py:4522 — libs/agno/agno/knowledge/knowledge.py:4522-4530 | libs/agno/agno/knowledge/knowledge.py:4545-4554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–10 lines × 2) libs/agno/agno/models/huggingface/huggingface.py:324 — libs/agno/agno/models/huggingface/huggingface.py:324-333 | libs/agno/agno/models/huggingface/huggingface.py:360-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) libs/agno/agno/models/perplexity/perplexity.py:140 — libs/agno/agno/models/perplexity/perplexity.py:140-148 | libs/agno/agno/models/perplexity/perplexity.py:174-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9–10 lines × 2) libs/agno/agno/tools/zep.py:161 — libs/agno/agno/tools/zep.py:161-170 | libs/agno/agno/tools/zep.py:375-383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/zep.py:375` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–10 lines × 2) REDACTED:249 — REDACTED:249-257 | REDACTED:979-988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:979` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) REDACTED:471 — REDACTED:471-479 | REDACTED:551-560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:471` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:470` calls `exception` and `REDACTED:550` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9–10 lines × 2) REDACTED:1137 — REDACTED:1137-1145 | REDACTED:1284-1293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×10
  • Duplicated block (8–9 lines × 2) cookbook/02_agents/05_state_and_session/session_state_advanced.py:33 — cookbook/02_agents/05_state_and_session/session_state_advanced.py:33-41 | cookbook/03_teams/21_state/nested_shared_state.py:34-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:855 — libs/agno/agno/db/dynamo/dynamo.py:855-863 | libs/agno/agno/db/dynamo/dynamo.py:2806-2813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:312 — libs/agno/agno/db/mongo/async_mongo.py:312-320 | libs/agno/agno/db/mongo/async_mongo.py:335-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:877 — libs/agno/agno/db/mysql/async_mysql.py:877-885 | REDACTED:1217-1224 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1216` calls `_get_table` and `libs/agno/agno/db/mysql/async_mysql.py:876` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/db/singlestore/singlestore.py:1903 — libs/agno/agno/db/singlestore/singlestore.py:1903-1911 | libs/agno/agno/db/singlestore/singlestore.py:1989-1996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/singlestore/singlestore.py:1903` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/os/routers/memory/memory.py:94 — libs/agno/agno/os/routers/memory/memory.py:94-102 | libs/agno/agno/os/routers/memory/memory.py:485-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/memory/memory.py:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/memory/memory.py:483` calls `Path` and `libs/agno/agno/os/routers/memory/memory.py:92` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/team/_run.py:2435 — libs/agno/agno/team/_run.py:2435-2442 | libs/agno/agno/team/_run.py:9738-9746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:9748` calls `TeamRunOutput`, `cast` and `libs/agno/agno/team/_run.py:2443` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/tools/x.py:79 — libs/agno/agno/tools/x.py:79-87 | libs/agno/agno/tools/x.py:104-111 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–9 lines × 2) REDACTED:481 — REDACTED:481-489 | REDACTED:562-569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:481` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) libs/agno/agno/vectordb/redis/redisdb.py:923 — libs/agno/agno/vectordb/redis/redisdb.py:923-930 | libs/agno/agno/vectordb/valkey/valkeydb.py:979-987 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `metadata` to `Mapping[str, Any]` in one and `Dict[str, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D2 · Cognitive Complexity · utils.calculate_date_metrics (cognitive 23) · ×9
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/dynamo/utils.py:355 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/gcs_json/utils.py:51 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/in_memory/utils.py:51 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/json/utils.py:51 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/mysql/utils.py:233 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/postgres/utils.py:284 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/redis/utils.py:197 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/singlestore/utils.py:260 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • utils.calculate_date_metrics (cognitive 23) libs/agno/agno/db/valkey/utils.py:392 — utils.calculate_date_metrics has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 5, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D29 · Static Analysis (SAST) · REDACTED · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×9
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/agent/_hooks.py:56 — libs/agno/agno/agent/_hooks.py:56-151 | libs/agno/agno/agent/_hooks.py:167-259 | libs/agno/agno/agent/_hooks.py:274-360 | libs/agno/agno/agent/_hooks.py:375-461 | libs/agno/agno/team/_hooks.py:253-335 | libs/agno/agno/team/_hooks.py:351-438 | libs/agno/agno/team/_hooks.py:453-533 | libs/agno/agno/team/_hooks.py:548-633 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/agent/_run.py:149 — libs/agno/agno/agent/_run.py:149-186 | libs/agno/agno/agent/_run.py:196-228 | libs/agno/agno/team/_run.py:5201-5229 | libs/agno/agno/team/_run.py:5233-5264 | libs/agno/agno/utils/callables.py:65-101 | libs/agno/agno/utils/callables.py:109-130 | libs/agno/agno/utils/callables.py:138-173 | libs/agno/agno/utils/callables.py:181-205 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/agent/_tools.py:1079 — libs/agno/agno/agent/_tools.py:1079-1121 | libs/agno/agno/agent/_tools.py:1131-1175 | libs/agno/agno/agent/_tools.py:1181-1231 | libs/agno/agno/agent/_tools.py:1241-1295 | libs/agno/agno/team/_run.py:5389-5441 | libs/agno/agno/team/_run.py:5451-5517 | libs/agno/agno/team/_run.py:5526-5595 | libs/agno/agno/team/_run.py:5605-5694 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) REDACTED:390 — REDACTED:390-450 | libs/agno/agno/db/mongo/mongo.py:2317-2372 | libs/agno/agno/db/mysql/async_mysql.py:2767-2822 | libs/agno/agno/db/mysql/mysql.py:2736-2789 | libs/agno/agno/db/postgres/async_postgres.py:3143-3196 | libs/agno/agno/db/postgres/postgres.py:3687-3740 | REDACTED:3295-3348 | REDACTED:4301-4354 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py:6519 — libs/agno/agno/db/postgres/async_postgres.py:6519-6529 | libs/agno/agno/db/postgres/async_postgres.py:7033-7051 | libs/agno/agno/db/postgres/postgres.py:9268-9276 | libs/agno/agno/db/postgres/postgres.py:9764-9780 | REDACTED:5688-5698 | REDACTED:6202-6220 | REDACTED:8197-8205 | REDACTED:8693-8709 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/db/postgres/async_postgres.py:6721 — libs/agno/agno/db/postgres/async_postgres.py:6721-6740 | libs/agno/agno/db/postgres/async_postgres.py:6986-7006 | libs/agno/agno/db/postgres/async_postgres.py:7011-7030 | libs/agno/agno/db/postgres/async_postgres.py:7033-7051 | REDACTED:5890-5909 | REDACTED:6155-6175 | REDACTED:6180-6199 | REDACTED:6202-6220 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/learn/stores/learned_knowledge.py:1109 — libs/agno/agno/learn/stores/learned_knowledge.py:1109-1150 | libs/agno/agno/learn/stores/learned_knowledge.py:1161-1202 | libs/agno/agno/learn/stores/session_context.py:508-580 | libs/agno/agno/learn/stores/session_context.py:591-650 | libs/agno/agno/learn/stores/user_memory.py:737-799 | libs/agno/agno/learn/stores/user_memory.py:810-862 | libs/agno/agno/learn/stores/user_profile.py:827-887 | libs/agno/agno/learn/stores/user_profile.py:897-947 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/tools/google/gmail.py:1442 — libs/agno/agno/tools/google/gmail.py:1442-1467 | libs/agno/agno/tools/google/gmail.py:1471-1495 | libs/agno/agno/tools/google/gmail.py:1540-1570 | libs/agno/agno/tools/google/gmail.py:1574-1591 | libs/agno/agno/tools/google/gmail.py:1595-1618 | libs/agno/agno/tools/google/gmail.py:1657-1680 | libs/agno/agno/tools/google/gmail.py:1793-1824 | libs/agno/agno/tools/google/gmail.py:1860-1878 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) libs/agno/agno/tools/whatsapp.py:125 — libs/agno/agno/tools/whatsapp.py:125-152 | libs/agno/agno/tools/whatsapp.py:161-192 | libs/agno/agno/tools/whatsapp.py:202-245 | libs/agno/agno/tools/whatsapp.py:256-320 | libs/agno/agno/tools/whatsapp.py:329-367 | libs/agno/agno/tools/whatsapp.py:377-418 | libs/agno/agno/tools/whatsapp.py:428-465 | libs/agno/agno/tools/whatsapp.py:473-502 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Duplicated block (45 lines × 2) · ×9
  • Duplicated block (45 lines × 2) cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py:122 — cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py:122-166 | cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py:174-218 — before extracting anything, compare `cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py` and `cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (45 lines × 2) libs/agno/agno/agent/_default_tools.py:98 — libs/agno/agno/agent/_default_tools.py:98-142 | libs/agno/agno/team/_default_tools.py:1606-1650 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (45 lines × 2) REDACTED:373 — REDACTED:373-417 | REDACTED:505-549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (45 lines × 2) REDACTED:1131 — REDACTED:1131-1175 | REDACTED:1201-1245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (45 lines × 2) libs/agno/agno/team/_run.py:2700 — libs/agno/agno/team/_run.py:2700-2744 | libs/agno/agno/team/_run.py:3831-3875 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2700` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (45 lines × 2) libs/agno/agno/team/_run.py:10138 — libs/agno/agno/team/_run.py:10138-10182 | libs/agno/agno/team/_run.py:10258-10302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:10138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:10186` calls `araise_if_cancelled` and `libs/agno/agno/team/_run.py:10307` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (45 lines × 2) libs/agno/agno/tools/google/gmail.py:640 — libs/agno/agno/tools/google/gmail.py:640-684 | libs/agno/agno/tools/google/gmail.py:705-749 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (45 lines × 2) libs/agno/agno/workflow/step.py:1313 — libs/agno/agno/workflow/step.py:1313-1357 | libs/agno/agno/workflow/step.py:2034-2078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1313` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (45 lines × 2) libs/agno_infra/agno/aws/resource/ec2/security_group.py:376 — libs/agno_infra/agno/aws/resource/ec2/security_group.py:376-420 | libs/agno_infra/agno/aws/resource/ec2/security_group.py:511-555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×9
  • Duplicated block (37 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:558 — libs/agno/agno/db/gcs_json/gcs_json_db.py:558-594 | libs/agno/agno/db/json/json_db.py:607-643 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1752 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1752-1788 | libs/agno/agno/db/json/json_db.py:1852-1888 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37 lines × 2) libs/agno/agno/db/postgres/postgres.py:6056 — libs/agno/agno/db/postgres/postgres.py:6056-6092 | REDACTED:5846-5882 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (37 lines × 2) libs/agno/agno/db/postgres/postgres.py:6372 — libs/agno/agno/db/postgres/postgres.py:6372-6408 | REDACTED:6156-6192 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37 lines × 2) libs/agno/agno/db/redis/redis.py:431 — libs/agno/agno/db/redis/redis.py:431-467 | libs/agno/agno/db/valkey/valkey.py:527-563 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37 lines × 2) libs/agno/agno/fs/toolkit.py:269 — libs/agno/agno/fs/toolkit.py:269-305 | libs/agno/agno/fs/toolkit.py:695-731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37 lines × 2) libs/agno/agno/models/openrouter/responses.py:83 — libs/agno/agno/models/openrouter/responses.py:83-119 | libs/agno/agno/models/ramp/router.py:110-146 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (37 lines × 2) REDACTED:1079 — REDACTED:1079-1115 | REDACTED:1180-1216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1078` calls `log_error` and `REDACTED:1179` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (37 lines × 2) libs/agno/agno/workflow/condition.py:492 — libs/agno/agno/workflow/condition.py:492-528 | libs/agno/agno/workflow/condition.py:947-983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×9
  • Duplicated block (32 lines × 2) cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_additional_data.py:61 — cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_additional_data.py:61-92 | cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_additional_data.py:126-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (32 lines × 2) libs/agno/agno/cloud/aws/s3/bucket.py:65 — libs/agno/agno/cloud/aws/s3/bucket.py:65-96 | libs/agno_infra/agno/aws/resource/s3/bucket.py:66-97 — before extracting anything, compare `libs/agno/agno/cloud/aws/s3/bucket.py` and `libs/agno_infra/agno/aws/resource/s3/bucket.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `AwsApiClient` names `agno.aws.api_client` in one and `agno.cloud.aws.s3.api_client` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (32 lines × 2) libs/agno/agno/db/postgres/postgres.py:1460 — libs/agno/agno/db/postgres/postgres.py:1460-1491 | REDACTED:1440-1471 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:1492` calls `_collect_sandbox_leftovers` and `REDACTED:1473` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (32 lines × 2) libs/agno/agno/db/postgres/postgres.py:7332 — libs/agno/agno/db/postgres/postgres.py:7332-7363 | REDACTED:7100-7131 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (32 lines × 2) libs/agno/agno/knowledge/loaders/azure_blob.py:223 — libs/agno/agno/knowledge/loaders/azure_blob.py:223-254 | libs/agno/agno/knowledge/loaders/azure_blob.py:371-402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (32 lines × 2) libs/agno/agno/knowledge/loaders/github.py:417 — libs/agno/agno/knowledge/loaders/github.py:417-448 | libs/agno/agno/knowledge/loaders/github.py:576-607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (32 lines × 2) libs/agno/agno/utils/print_response/team.py:209 — libs/agno/agno/utils/print_response/team.py:209-240 | libs/agno/agno/utils/print_response/team.py:1144-1175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (32 lines × 2) libs/agno/agno/workflow/loop.py:633 — libs/agno/agno/workflow/loop.py:633-664 | libs/agno/agno/workflow/loop.py:1030-1061 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (32 lines × 2) libs/agno_infra/agno/cli/operator.py:170 — libs/agno_infra/agno/cli/operator.py:170-201 | libs/agno_infra/agno/infra/operator.py:317-348 — `libs/agno_infra/agno/cli/operator.py` and `libs/agno_infra/agno/infra/operator.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 123 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/cli/operator.py:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×9
  • Duplicated block (18 lines × 4) libs/agno/agno/agent/_cli.py:83 — libs/agno/agno/agent/_cli.py:83-100 | libs/agno/agno/agent/_cli.py:184-201 | libs/agno/agno/team/_cli.py:108-125 | libs/agno/agno/team/_cli.py:214-231 — `libs/agno/agno/agent/_cli.py` and `libs/agno/agno/team/_cli.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 4) libs/agno/agno/db/gcs_json/gcs_json_db.py:1781 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1781-1798 | libs/agno/agno/db/json/json_db.py:1881-1898 | libs/agno/agno/db/redis/redis.py:2166-2183 | libs/agno/agno/db/valkey/valkey.py:2649-2666 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 4) REDACTED:429 — REDACTED:429-446 | REDACTED:752-769 | REDACTED:358-375 | REDACTED:679-696 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 4) libs/agno/agno/db/mysql/mysql.py:757 — libs/agno/agno/db/mysql/mysql.py:757-774 | libs/agno/agno/db/postgres/postgres.py:1255-1272 | libs/agno/agno/db/singlestore/singlestore.py:814-831 | REDACTED:1242-1259 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 4) libs/agno/agno/db/mysql/mysql.py:2084 — libs/agno/agno/db/mysql/mysql.py:2084-2101 | libs/agno/agno/db/postgres/postgres.py:2973-2990 | libs/agno/agno/db/singlestore/singlestore.py:2109-2126 | REDACTED:2894-2911 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (18 lines × 4) libs/agno/agno/db/mysql/mysql.py:2714 — libs/agno/agno/db/mysql/mysql.py:2714-2731 | libs/agno/agno/db/postgres/postgres.py:3665-3682 | libs/agno/agno/db/singlestore/singlestore.py:2713-2730 | REDACTED:3526-3543 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 4) libs/agno/agno/models/aws/bedrock.py:561 — libs/agno/agno/models/aws/bedrock.py:561-578 | libs/agno/agno/models/aws/bedrock.py:607-624 | libs/agno/agno/models/aws/bedrock.py:657-674 | libs/agno/agno/models/aws/bedrock.py:706-723 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/models/aws/bedrock.py:579` calls `log_debug` and `libs/agno/agno/models/aws/bedrock.py:625` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 4) libs/agno/agno/team/_run.py:2729 — libs/agno/agno/team/_run.py:2729-2746 | libs/agno/agno/team/_run.py:3860-3877 | libs/agno/agno/team/_run.py:10167-10184 | libs/agno/agno/team/_run.py:10287-10304 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:2748` calls `araise_if_cancelled` and `libs/agno/agno/team/_run.py:10307` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 4) libs/agno/agno/db/mysql/mysql.py:309 — libs/agno/agno/db/mysql/mysql.py:309-328 | libs/agno/agno/db/postgres/postgres.py:354-380 | libs/agno/agno/db/singlestore/singlestore.py:216-233 | REDACTED:351-377 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×9
  • Duplicated block (18 lines × 3) cookbook/12_context/25_write_tools_restriction.py:61 — cookbook/12_context/25_write_tools_restriction.py:61-78 | cookbook/12_context/25_write_tools_restriction.py:106-123 | cookbook/12_context/25_write_tools_restriction.py:153-170 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/12_context/25_write_tools_restriction.py:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 3) libs/agno/agno/agent/agent.py:1923 — libs/agno/agno/agent/agent.py:1923-1940 | libs/agno/agno/team/team.py:1965-1982 | libs/agno/agno/workflow/workflow.py:11996-12013 — `libs/agno/agno/agent/agent.py` and `libs/agno/agno/team/team.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:938 — libs/agno/agno/db/gcs_json/gcs_json_db.py:938-955 | libs/agno/agno/db/in_memory/in_memory_db.py:777-794 | libs/agno/agno/db/json/json_db.py:1005-1022 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2745 — libs/agno/agno/db/mysql/async_mysql.py:2745-2762 | libs/agno/agno/db/postgres/async_postgres.py:3121-3138 | REDACTED:3273-3290 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 3) libs/agno/agno/os/routers/agents/router.py:1337 — libs/agno/agno/os/routers/agents/router.py:1337-1354 | libs/agno/agno/os/routers/teams/router.py:1228-1245 | libs/agno/agno/os/routers/workflows/router.py:2647-2664 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1337` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 3) libs/agno/agno/team/_run.py:2443 — libs/agno/agno/team/_run.py:2443-2460 | libs/agno/agno/team/_run.py:3382-3399 | libs/agno/agno/team/_run.py:9750-9767 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:9748` calls `TeamRunOutput`, `cast` and `libs/agno/agno/team/_run.py:2442` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 3) libs/agno/agno/tools/zoom.py:157 — libs/agno/agno/tools/zoom.py:157-174 | libs/agno/agno/tools/zoom.py:190-213 | libs/agno/agno/tools/zoom.py:238-257 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 3) libs/agno/agno/utils/print_response/agent.py:205 — libs/agno/agno/utils/print_response/agent.py:205-222 | libs/agno/agno/utils/print_response/agent.py:412-429 | libs/agno/agno/utils/print_response/agent.py:650-667 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (18 lines × 3) REDACTED:675 — REDACTED:675-692 | REDACTED:764-781 | REDACTED:871-888 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:675` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×9
  • Duplicated block (15–16 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:432 — libs/agno/agno/db/postgres/async_postgres.py:432-446 | libs/agno/agno/db/postgres/postgres.py:529-544 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/models/mistral/mistral.py:224 — libs/agno/agno/models/mistral/mistral.py:224-239 | libs/agno/agno/models/mistral/mistral.py:307-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/mistral/mistral.py:224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/run/agent.py:967 — libs/agno/agno/run/agent.py:967-982 | libs/agno/agno/run/team.py:1004-1018 — before extracting anything, compare `libs/agno/agno/run/agent.py` and `libs/agno/agno/run/team.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 181 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/team/_default_tools.py:825 — libs/agno/agno/team/_default_tools.py:825-840 | libs/agno/agno/team/_default_tools.py:1011-1025 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:1011` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/team/_run.py:5413 — libs/agno/agno/team/_run.py:5413-5427 | libs/agno/agno/team/_run.py:5480-5495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:5413` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/tools/google/calendar.py:232 — libs/agno/agno/tools/google/calendar.py:232-246 | libs/agno/agno/tools/google/calendar.py:868-883 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/tools/superserve.py:666 — libs/agno/agno/tools/superserve.py:666-680 | libs/agno/agno/tools/superserve.py:686-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/tools/superserve.py:680` calls `_error` and `libs/agno/agno/tools/superserve.py:701` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15–16 lines × 2) libs/agno/agno/utils/pprint.py:79 — libs/agno/agno/utils/pprint.py:79-94 | libs/agno/agno/utils/pprint.py:164-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–16 lines × 2) REDACTED:1155 — REDACTED:1155-1170 | REDACTED:1271-1285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×9
  • Duplicated block (11–12 lines × 2) cookbook/performance/comparison/run_all.py:120 — cookbook/performance/comparison/run_all.py:120-130 | cookbook/performance/run_all.py:53-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:2844 — libs/agno/agno/db/dynamo/dynamo.py:2844-2855 | libs/agno/agno/db/firestore/firestore.py:2441-2451 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/db/postgres/postgres.py:8721 — libs/agno/agno/db/postgres/postgres.py:8721-8732 | REDACTED:7653-7663 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/os/authz/native_engine.py:442 — libs/agno/agno/os/authz/native_engine.py:442-452 | libs/agno/agno/os/authz/native_engine.py:471-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/tools/studio.py:3418 — libs/agno/agno/tools/studio.py:3418-3429 | libs/agno/agno/tools/studio.py:3503-3513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio.py:3418` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/utils/pprint.py:67 — libs/agno/agno/utils/pprint.py:67-78 | libs/agno/agno/utils/pprint.py:152-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/workflow/condition.py:526 — libs/agno/agno/workflow/condition.py:526-537 | libs/agno/agno/workflow/condition.py:739-749 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:526` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/workflow/workflow.py:3020 — libs/agno/agno/workflow/workflow.py:3020-3031 | libs/agno/agno/workflow/workflow.py:7312-7322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 2) libs/agno/agno/workflow/workflow.py:4025 — libs/agno/agno/workflow/workflow.py:4025-4036 | libs/agno/agno/workflow/workflow.py:9362-9372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×9
  • Duplicated block (6 lines × 3) libs/agno/agno/db/firestore/firestore.py:844 — libs/agno/agno/db/firestore/firestore.py:844-851 | libs/agno/agno/db/mongo/async_mongo.py:1065-1072 | libs/agno/agno/db/mongo/mongo.py:878-883 — before extracting anything, compare `libs/agno/agno/db/firestore/firestore.py` and `libs/agno/agno/db/mongo/async_mongo.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/firestore/firestore.py:844` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 3) libs/agno/agno/db/postgres/postgres.py:8206 — libs/agno/agno/db/postgres/postgres.py:8206-8211 | libs/agno/agno/db/postgres/postgres.py:8447-8452 | REDACTED:7379-7384 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) libs/agno/agno/os/routers/approvals/router.py:53 — libs/agno/agno/os/routers/approvals/router.py:53-58 | libs/agno/agno/os/routers/schedules/router.py:93-98 | libs/agno/agno/os/routers/service_accounts/router.py:83-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `method_name` to `str` in one and `_SchedulerDbMethod` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 3) libs/agno/agno/os/utils.py:2318 — libs/agno/agno/os/utils.py:2318-2323 | libs/agno/agno/os/utils.py:2329-2334 | libs/agno/agno/os/utils.py:2415-2420 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) libs/agno/agno/team/_run.py:1061 — libs/agno/agno/team/_run.py:1061-1066 | libs/agno/agno/team/_run.py:1877-1884 | libs/agno/agno/team/_run.py:8635-8640 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) libs/agno/agno/workflow/condition.py:235 — libs/agno/agno/workflow/condition.py:235-240 | libs/agno/agno/workflow/loop.py:239-244 | libs/agno/agno/workflow/router.py:277-282 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:235` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) libs/agno/agno/workflow/loop.py:370 — libs/agno/agno/workflow/loop.py:370-375 | libs/agno/agno/workflow/parallel.py:175-180 | libs/agno/agno/workflow/steps.py:193-198 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:370` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) cookbook/02_agents/05_state_and_session/session_state_basic.py:15 — cookbook/02_agents/05_state_and_session/session_state_basic.py:15-20 | cookbook/02_agents/05_state_and_session/session_state_events.py:15-20 | cookbook/02_agents/05_state_and_session/session_state_manual_update.py:15-20 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 3) cookbook/07_knowledge/02_building_blocks/08_mmr_diverse_results.py:66 — cookbook/07_knowledge/02_building_blocks/08_mmr_diverse_results.py:66-71 | cookbook/07_knowledge/02_building_blocks/09_mmr_with_pgvector.py:70-75 | cookbook/07_knowledge/02_building_blocks/10_mmr_with_elasticsearch.py:72-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×8
  • Duplicated block (36 lines × 2) cookbook/91_tools/mcp/mcp_toolbox_demo/agent.py:50 — cookbook/91_tools/mcp/mcp_toolbox_demo/agent.py:50-85 | cookbook/91_tools/mcp/mcp_toolbox_for_db.py:48-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/91_tools/mcp/mcp_toolbox_demo/agent.py:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (36 lines × 2) libs/agno/agno/agent/_run.py:1434 — libs/agno/agno/agent/_run.py:1434-1469 | libs/agno/agno/agent/_run.py:2826-2861 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (36 lines × 2) libs/agno/agno/agent/_run.py:2612 — libs/agno/agno/agent/_run.py:2612-2647 | libs/agno/agno/agent/_run.py:5728-5763 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5727` calls `RunOutput` and `libs/agno/agno/agent/_run.py:2611` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (36 lines × 2) libs/agno/agno/agent/_tools.py:1191 — libs/agno/agno/agent/_tools.py:1191-1226 | libs/agno/agno/agent/_tools.py:1253-1288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:1191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (36 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:7192 — libs/agno/agno/db/postgres/async_postgres.py:7192-7227 | REDACTED:6361-6396 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:7192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (36 lines × 2) libs/agno/agno/db/postgres/postgres.py:3095 — libs/agno/agno/db/postgres/postgres.py:3095-3130 | REDACTED:3012-3047 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (36 lines × 2) libs/agno/agno/db/postgres/postgres.py:9547 — libs/agno/agno/db/postgres/postgres.py:9547-9582 | REDACTED:8476-8511 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:9547` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (36 lines × 2) libs/agno/agno/os/middleware/jwt.py:1162 — libs/agno/agno/os/middleware/jwt.py:1162-1197 | libs/agno/agno/os/middleware/jwt.py:1346-1381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/middleware/jwt.py:1162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28–29 lines × 2) · ×8
  • Duplicated block (28–29 lines × 2) libs/agno/agno/agent/_messages.py:951 — libs/agno/agno/agent/_messages.py:951-978 | libs/agno/agno/agent/_messages.py:1247-1275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:951` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/agent/_response.py:1162 — libs/agno/agno/agent/_response.py:1162-1190 | libs/agno/agno/agent/_response.py:1329-1356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/agent/_run.py:1558 — libs/agno/agno/agent/_run.py:1558-1586 | libs/agno/agno/agent/_run.py:2166-2193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1558` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/db/mysql/mysql.py:1147 — libs/agno/agno/db/mysql/mysql.py:1147-1175 | libs/agno/agno/db/singlestore/singlestore.py:1203-1230 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/db/mysql/utils.py:422 — libs/agno/agno/db/mysql/utils.py:422-450 | libs/agno/agno/db/postgres/utils.py:170-197 — `libs/agno/agno/db/mysql/utils.py` and `libs/agno/agno/db/postgres/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 14 separate duplicated blocks between them, totalling at least 283 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:344 — libs/agno/agno/db/postgres/async_postgres.py:344-372 | libs/agno/agno/db/postgres/postgres.py:383-410 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/team/_default_tools.py:768 — libs/agno/agno/team/_default_tools.py:768-795 | libs/agno/agno/team/_default_tools.py:1126-1154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:768` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28–29 lines × 2) libs/agno/agno/tools/youtube.py:126 — libs/agno/agno/tools/youtube.py:126-153 | libs/agno/agno/tools/youtube.py:162-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×8
  • Duplicated block (26–27 lines × 2) libs/agno/agno/agent/_utils.py:198 — libs/agno/agno/agent/_utils.py:198-224 | libs/agno/agno/team/_utils.py:190-215 — `libs/agno/agno/agent/_utils.py` and `libs/agno/agno/team/_utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 107 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–27 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3984 — libs/agno/agno/db/postgres/async_postgres.py:3984-4009 | REDACTED:4116-4142 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–27 lines × 2) libs/agno/agno/db/postgres/postgres.py:6278 — libs/agno/agno/db/postgres/postgres.py:6278-6304 | REDACTED:6063-6088 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:6278` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–27 lines × 2) libs/agno/agno/db/redis/redis.py:672 — libs/agno/agno/db/redis/redis.py:672-698 | libs/agno/agno/db/valkey/valkey.py:797-822 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–27 lines × 2) libs/agno/agno/os/routers/workflows/router.py:2291 — libs/agno/agno/os/routers/workflows/router.py:2291-2317 | libs/agno/agno/os/routers/workflows/router.py:2624-2649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26–27 lines × 2) libs/agno/agno/tools/whatsapp.py:329 — libs/agno/agno/tools/whatsapp.py:329-354 | libs/agno/agno/tools/whatsapp.py:377-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–27 lines × 2) REDACTED:2334 — REDACTED:2334-2360 | REDACTED:1879-1904 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2334` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–27 lines × 2) libs/agno/agno/workflow/workflow.py:5354 — libs/agno/agno/workflow/workflow.py:5354-5379 | libs/agno/agno/workflow/workflow.py:10503-10529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5354` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×8
  • Duplicated block (23–24 lines × 2) cookbook/frameworks/claude-agent-sdk/claude_media.py:61 — cookbook/frameworks/claude-agent-sdk/claude_media.py:61-84 | cookbook/frameworks/codex/codex_media.py:59-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/frameworks/claude-agent-sdk/claude_media.py:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–24 lines × 2) libs/agno/agno/agent/_run.py:2588 — libs/agno/agno/agent/_run.py:2588-2611 | libs/agno/agno/agent/_run.py:5703-5725 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_run.py:5727` calls `RunOutput` and `libs/agno/agno/agent/_run.py:2612` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (23–24 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:371 — libs/agno/agno/db/postgres/async_postgres.py:371-393 | REDACTED:355-378 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:371` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–24 lines × 2) libs/agno/agno/tools/github.py:1186 — libs/agno/agno/tools/github.py:1186-1209 | libs/agno/agno/tools/github.py:1392-1414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/github.py:1186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23–24 lines × 2) libs/agno/agno/tools/google/gmail.py:1540 — libs/agno/agno/tools/google/gmail.py:1540-1562 | libs/agno/agno/tools/google/gmail.py:1793-1816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23–24 lines × 2) libs/agno/agno/utils/agent.py:1143 — libs/agno/agno/utils/agent.py:1143-1166 | libs/agno/agno/utils/agent.py:1172-1194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23–24 lines × 2) REDACTED:503 — REDACTED:503-525 | REDACTED:692-715 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (23–24 lines × 2) REDACTED:646 — REDACTED:646-668 | REDACTED:839-862 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×8
  • Duplicated block (22–23 lines × 2) cookbook/04_workflows/06_advanced_concepts/session_state/state_in_function.py:157 — cookbook/04_workflows/06_advanced_concepts/session_state/state_in_function.py:157-178 | cookbook/04_workflows/06_advanced_concepts/session_state/state_in_function.py:272-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/agent/_run.py:1808 — libs/agno/agno/agent/_run.py:1808-1830 | libs/agno/agno/agent/_run.py:5036-5057 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1808` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/db/base.py:337 — libs/agno/agno/db/base.py:337-358 | libs/agno/agno/db/base.py:2669-2691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2058 — libs/agno/agno/db/mysql/async_mysql.py:2058-2079 | REDACTED:2586-2608 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/db/postgres/postgres.py:7552 — libs/agno/agno/db/postgres/postgres.py:7552-7574 | REDACTED:7337-7358 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/team/_response.py:280 — libs/agno/agno/team/_response.py:280-302 | libs/agno/agno/team/_response.py:353-374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/team/_run.py:2236 — libs/agno/agno/team/_run.py:2236-2258 | libs/agno/agno/team/_run.py:3218-3239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2236` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:3215` calls `cast`, `_astart_memory_task` and `libs/agno/agno/team/_run.py:2236` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22–23 lines × 2) libs/agno/agno/team/_run.py:6413 — libs/agno/agno/team/_run.py:6413-6435 | libs/agno/agno/team/_run.py:6495-6516 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:6413` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×8
  • Duplicated block (18–20 lines × 2) libs/agno/agno/agent/_response.py:783 — libs/agno/agno/agent/_response.py:783-800 | libs/agno/agno/team/_response.py:835-854 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:783` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–20 lines × 2) libs/agno/agno/os/routers/traces/traces.py:257 — libs/agno/agno/os/routers/traces/traces.py:257-274 | libs/agno/agno/os/routers/traces/traces.py:619-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/traces/traces.py:257` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–20 lines × 2) libs/agno/agno/team/_run.py:2176 — libs/agno/agno/team/_run.py:2176-2193 | libs/agno/agno/team/_run.py:3142-3161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–20 lines × 2) libs/agno/agno/team/_run.py:5389 — libs/agno/agno/team/_run.py:5389-5408 | libs/agno/agno/team/_run.py:5451-5468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–20 lines × 2) libs/agno/agno/team/_run.py:7701 — libs/agno/agno/team/_run.py:7701-7720 | libs/agno/agno/team/_run.py:7804-7821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:7701` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–20 lines × 2) REDACTED:1095 — REDACTED:1095-1112 | REDACTED:1405-1424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–20 lines × 2) libs/agno/agno/workflow/workflow.py:3589 — libs/agno/agno/workflow/workflow.py:3589-3608 | libs/agno/agno/workflow/workflow.py:8422-8439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3589` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–20 lines × 2) libs/agno/agno/workflow/workflow.py:9122 — libs/agno/agno/workflow/workflow.py:9122-9139 | libs/agno/agno/workflow/workflow.py:9296-9315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×8
  • Duplicated block (19 lines × 3) libs/agno/agno/db/mysql/mysql.py:575 — libs/agno/agno/db/mysql/mysql.py:575-593 | libs/agno/agno/db/singlestore/singlestore.py:654-672 | REDACTED:999-1017 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:575` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 3) libs/agno/agno/db/mysql/mysql.py:1982 — libs/agno/agno/db/mysql/mysql.py:1982-2000 | libs/agno/agno/db/singlestore/singlestore.py:2000-2018 | REDACTED:2772-2790 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1982` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 3) libs/agno/agno/knowledge/loaders/azure_blob.py:244 — libs/agno/agno/knowledge/loaders/azure_blob.py:244-262 | libs/agno/agno/knowledge/loaders/github.py:438-456 | libs/agno/agno/knowledge/loaders/sharepoint.py:290-308 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (19 lines × 3) libs/agno/agno/learn/schemas.py:480 — libs/agno/agno/learn/schemas.py:480-498 | libs/agno/agno/learn/schemas.py:622-640 | libs/agno/agno/learn/schemas.py:1112-1130 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 3) libs/agno/agno/os/routers/agents/router.py:502 — libs/agno/agno/os/routers/agents/router.py:502-520 | libs/agno/agno/os/routers/teams/router.py:266-284 | libs/agno/agno/os/routers/workflows/router.py:1445-1463 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 3) libs/agno/agno/os/routers/agents/router.py:2218 — libs/agno/agno/os/routers/agents/router.py:2218-2236 | libs/agno/agno/os/routers/agents/router.py:2566-2584 | libs/agno/agno/os/routers/workflows/router.py:2772-2790 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/workflows/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 413 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2218` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 3) libs/agno/agno/tools/serper.py:119 — libs/agno/agno/tools/serper.py:119-137 | libs/agno/agno/tools/serper.py:197-215 | libs/agno/agno/tools/serper.py:237-255 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/tools/serper.py:236` calls `log_warning` and `libs/agno/agno/tools/serper.py:118` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19 lines × 3) libs/agno/agno/workflow/step.py:428 — libs/agno/agno/workflow/step.py:428-446 | libs/agno/agno/workflow/step.py:537-555 | libs/agno/agno/workflow/step.py:694-712 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×8
  • Duplicated block (10–11 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:287 — libs/agno/agno/db/mysql/async_mysql.py:287-297 | libs/agno/agno/db/postgres/async_postgres.py:469-478 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:299` calls `log_debug` and `libs/agno/agno/db/postgres/async_postgres.py:481` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:881 — libs/agno/agno/db/mysql/async_mysql.py:881-890 | libs/agno/agno/db/postgres/async_postgres.py:1264-1274 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1262` calls `_collect_sandbox_leftovers` and `libs/agno/agno/db/mysql/async_mysql.py:879` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2082 — libs/agno/agno/db/mysql/async_mysql.py:2082-2091 | libs/agno/agno/db/mysql/mysql.py:2053-2063 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2082` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) libs/agno/agno/models/google/gemini_interactions.py:1357 — libs/agno/agno/models/google/gemini_interactions.py:1357-1367 | libs/agno/agno/models/google/gemini_interactions.py:1457-1466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) libs/agno/agno/os/routers/traces/traces.py:431 — libs/agno/agno/os/routers/traces/traces.py:431-440 | libs/agno/agno/os/routers/traces/traces.py:456-466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) libs/agno/agno/team/_tools.py:407 — libs/agno/agno/team/_tools.py:407-417 | libs/agno/agno/team/_tools.py:440-449 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) libs/agno/agno/tools/google/calendar.py:248 — libs/agno/agno/tools/google/calendar.py:248-258 | libs/agno/agno/tools/google/calendar.py:895-904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 2) REDACTED:1927 — REDACTED:1927-1936 | REDACTED:1685-1695 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 7) · ×8
  • Duplicated block (9 lines × 7) libs/agno/agno/db/mongo/async_mongo.py:3500 — libs/agno/agno/db/mongo/async_mongo.py:3500-3508 | libs/agno/agno/db/mongo/async_mongo.py:3681-3689 | libs/agno/agno/db/mongo/async_mongo.py:3755-3763 | libs/agno/agno/db/mongo/mongo.py:3356-3364 | libs/agno/agno/db/mongo/mongo.py:3485-3493 | libs/agno/agno/db/mongo/mongo.py:3555-3563 | libs/agno/agno/tools/todoist.py:162-170 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:774 — libs/agno/agno/db/mysql/async_mysql.py:774-782 | libs/agno/agno/db/mysql/mysql.py:764-772 | libs/agno/agno/db/postgres/async_postgres.py:1113-1121 | libs/agno/agno/db/postgres/postgres.py:1262-1270 | libs/agno/agno/db/singlestore/singlestore.py:821-829 | REDACTED:1065-1073 | REDACTED:1249-1257 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:989 — libs/agno/agno/db/mysql/async_mysql.py:989-997 | libs/agno/agno/db/mysql/mysql.py:984-992 | libs/agno/agno/db/postgres/async_postgres.py:1569-1577 | libs/agno/agno/db/postgres/postgres.py:1802-1810 | libs/agno/agno/db/singlestore/singlestore.py:1039-1047 | REDACTED:1497-1505 | REDACTED:1758-1766 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:989` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:1265 — libs/agno/agno/db/mysql/async_mysql.py:1265-1273 | libs/agno/agno/db/mysql/mysql.py:1255-1263 | libs/agno/agno/db/postgres/async_postgres.py:1878-1886 | libs/agno/agno/db/postgres/postgres.py:2109-2117 | libs/agno/agno/db/singlestore/singlestore.py:1313-1321 | REDACTED:1758-1766 | REDACTED:2015-2023 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1888` calls `ValueError` and `REDACTED:1768` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2366 — libs/agno/agno/db/mysql/async_mysql.py:2366-2374 | libs/agno/agno/db/mysql/mysql.py:2336-2344 | libs/agno/agno/db/postgres/async_postgres.py:2712-2720 | libs/agno/agno/db/postgres/postgres.py:3243-3251 | libs/agno/agno/db/singlestore/singlestore.py:2360-2368 | REDACTED:2912-2920 | REDACTED:3166-3174 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mysql/mysql.py:2333` calls `validate_pagination` and `libs/agno/agno/db/postgres/postgres.py:3240` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 7) libs/agno/agno/db/postgres/async_postgres.py:4196 — libs/agno/agno/db/postgres/async_postgres.py:4196-4204 | libs/agno/agno/db/postgres/async_postgres.py:4259-4267 | libs/agno/agno/db/postgres/postgres.py:6928-6936 | libs/agno/agno/db/postgres/postgres.py:6992-7000 | REDACTED:4333-4341 | REDACTED:6699-6707 | REDACTED:6761-6769 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 7) libs/agno/agno/reasoning/azure_ai_foundry.py:102 — libs/agno/agno/reasoning/azure_ai_foundry.py:102-110 | libs/agno/agno/reasoning/deepseek.py:85-93 | libs/agno/agno/reasoning/gemini.py:131-139 | libs/agno/agno/reasoning/groq.py:118-126 | libs/agno/agno/reasoning/moonshot.py:157-165 | libs/agno/agno/reasoning/ollama.py:159-167 | libs/agno/agno/reasoning/openai.py:141-149 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/deepseek.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 7) libs/agno/agno/reasoning/azure_ai_foundry.py:148 — libs/agno/agno/reasoning/azure_ai_foundry.py:148-156 | libs/agno/agno/reasoning/deepseek.py:164-172 | libs/agno/agno/reasoning/gemini.py:171-179 | libs/agno/agno/reasoning/groq.py:169-177 | libs/agno/agno/reasoning/moonshot.py:202-210 | libs/agno/agno/reasoning/ollama.py:205-213 | libs/agno/agno/reasoning/openai.py:197-205 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/deepseek.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D15 · Churn × Complexity Hotspots · Repeated repair · ×7
  • Repeated repair: libs/agno/agno/os/routers/company/runs.py libs/agno/agno/os/routers/company/runs.py:38 — libs/agno/agno/os/routers/company/runs.py changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is runs._run_route at line 38), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: allow authorized members to trigger Company routines (#11254)”; “fix: keep Company Task projection off the queue's critical path (#11188)”; “fix: clarify accepted Company Task execution (#11261)”; “fix: stabilize Company Task session ownership and recovery (#11126)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/routers/company/runs.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: libs/agno/agno/exceptions.py libs/agno/agno/exceptions.py:278 — libs/agno/agno/exceptions.py changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is EmbeddingError.reason at line 278), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: confine harness attachment staging and roll back failures (#10971)”; “fix: harness soak follow-ups: tool errors, resume status, one turn per session (#10958)”; “fix: keep failed attempts' tools and announce retries to streaming consumers (#10937)”; “fix: surface embedding failures during knowledge ingestion (#9814)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/exceptions.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: libs/agno/agno/os/routers/knowledge/knowledge.py libs/agno/agno/os/routers/knowledge/knowledge.py:1724 — libs/agno/agno/os/routers/knowledge/knowledge.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is knowledge.process_content at line 1724), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: reject unsupported knowledge URL input types (#11260)”; “fix: reject knowledge uploads without a content source (#11259)”; “fix: surface embedding failures during knowledge ingestion (#9814)”; “fix: guard aborted promotions, cap-truncated reads, and remote parent_id filtering (#9860)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/routers/knowledge/knowledge.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: libs/agno/agno/os/manager/manager.py libs/agno/agno/os/manager/manager.py:154 — libs/agno/agno/os/manager/manager.py changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is manager._build_manager at line 154), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: let OS Manager discover and run external agents (#11247)”; “fix: bound OS Manager tool use and ground explanations (#11175)”; “fix: keep OS Manager focused on the question (#11169)”; “fix: keep OS Manager specialists internal (#11077)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/manager/manager.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: libs/agno/agno/models/azure/claude.py libs/agno/agno/models/azure/claude.py:56 — libs/agno/agno/models/azure/claude.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is Claude._get_client_params at line 56), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: send adaptive thinking when a Claude model rejects a thinking budget (#11215)”; “fix: default Claude to sonnet-5-5 before sonnet-4-5 retires (#11212)”; “fix: replay Anthropic assistant turns verbatim so thinking blocks are not rejected (#9924)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/models/azure/claude.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: libs/agno/agno/os/manager/config.py libs/agno/agno/os/manager/config.py:66 — libs/agno/agno/os/manager/config.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is OSManager.__post_init__ at line 66), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: bound OS Manager tool use and ground explanations (#11175)”; “fix: keep OS Manager focused on the question (#11169)”; “fix: keep OS Manager specialists internal (#11077)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/os/manager/config.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: libs/agno/agno/knowledge/reader/json_reader.py libs/agno/agno/knowledge/reader/json_reader.py:53 — libs/agno/agno/knowledge/reader/json_reader.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is JSONReader._read_documents at line 53), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “[fix] Handle non-string stream names in JSONReader (#10634)”; “[fix] Preserve scalar JSON roots in JSONReader (#10402)”; “[fix] Await async chunking in JSONReader (#10167)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 14:45:52 +01:00' --until='2026-10-23 14:45:52 +01:00' --full-history --no-merges -- libs/agno/agno/knowledge/reader/json_reader.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×7
  • Duplicated block (29–30 lines × 2) cookbook/03_teams/14_run_control/background_execution.py:38 — cookbook/03_teams/14_run_control/background_execution.py:38-66 | cookbook/03_teams/14_run_control/background_execution.py:105-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/03_teams/14_run_control/background_execution.py:38` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/03_teams/14_run_control/background_execution.py:66` calls `arun` and `cookbook/03_teams/14_run_control/background_execution.py:135` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (29–30 lines × 2) REDACTED:1199 — REDACTED:1199-1228 | REDACTED:1335-1363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29–30 lines × 2) REDACTED:2962 — REDACTED:2962-2991 | REDACTED:3215-3243 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2962` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (29–30 lines × 2) libs/agno/agno/knowledge/knowledge.py:4827 — libs/agno/agno/knowledge/knowledge.py:4827-4855 | libs/agno/agno/knowledge/knowledge.py:4882-4911 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29–30 lines × 2) libs/agno/agno/os/utils.py:1602 — libs/agno/agno/os/utils.py:1602-1631 | libs/agno/agno/os/utils.py:1668-1696 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29–30 lines × 2) libs/agno/agno/team/_default_tools.py:164 — libs/agno/agno/team/_default_tools.py:164-193 | libs/agno/agno/team/_default_tools.py:196-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (29–30 lines × 2) libs/agno/agno/team/_tools.py:574 — libs/agno/agno/team/_tools.py:574-603 | libs/agno/agno/team/_tools.py:611-639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_context` to `Optional["RunContext"] = None` in one and `Optional[RunContext] = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×7
  • Duplicated block (27–28 lines × 2) libs/agno/agno/agent/_cli.py:83 — libs/agno/agno/agent/_cli.py:83-110 | libs/agno/agno/agent/_cli.py:184-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_cli.py:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27–28 lines × 2) libs/agno/agno/agent/_messages.py:1175 — libs/agno/agno/agent/_messages.py:1175-1202 | libs/agno/agno/agent/_messages.py:1479-1505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27–28 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:174 — libs/agno/agno/db/mysql/async_mysql.py:174-201 | libs/agno/agno/db/mysql/mysql.py:170-196 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (27–28 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:4174 — libs/agno/agno/db/postgres/async_postgres.py:4174-4200 | REDACTED:4310-4337 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27–28 lines × 2) libs/agno/agno/db/redis/redis.py:1839 — libs/agno/agno/db/redis/redis.py:1839-1865 | libs/agno/agno/db/valkey/valkey.py:2269-2296 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27–28 lines × 2) libs/agno/agno/models/azure/openai_chat.py:62 — libs/agno/agno/models/azure/openai_chat.py:62-89 | libs/agno/agno/models/azure/openai_responses.py:66-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27–28 lines × 2) REDACTED:588 — REDACTED:588-614 | REDACTED:655-682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:653` calls `_ensure_async_client` and `REDACTED:587` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22 lines × 3) · ×7
  • Duplicated block (22 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:1352 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1352-1373 | libs/agno/agno/db/in_memory/in_memory_db.py:1179-1200 | libs/agno/agno/db/json/json_db.py:1434-1455 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 3) REDACTED:1902 — REDACTED:1902-1923 | REDACTED:1962-1983 | REDACTED:2022-2043 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1902` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 3) REDACTED:2159 — REDACTED:2159-2180 | REDACTED:2219-2240 | REDACTED:2279-2300 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 3) libs/agno/agno/learn/stores/session_context.py:307 — libs/agno/agno/learn/stores/session_context.py:307-328 | libs/agno/agno/learn/stores/user_memory.py:465-486 | libs/agno/agno/learn/stores/user_profile.py:633-654 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:360 — libs/agno/agno/os/interfaces/a2a/router.py:360-381 | libs/agno/agno/os/interfaces/a2a/router.py:687-708 | libs/agno/agno/os/interfaces/a2a/router.py:898-919 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:360` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 3) libs/agno/agno/workflow/workflow.py:7586 — libs/agno/agno/workflow/workflow.py:7586-7607 | libs/agno/agno/workflow/workflow.py:7675-7696 | libs/agno/agno/workflow/workflow.py:7760-7781 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:7586` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:316 — libs/agno/agno/db/mysql/async_mysql.py:316-337 | libs/agno/agno/db/postgres/async_postgres.py:316-341 | REDACTED:301-326 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×7
  • Duplicated block (21–22 lines × 2) cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:110 — cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:110-131 | cookbook/frameworks/codex/codex_metrics_agentos.py:105-125 — `cookbook/frameworks/claude-agent-sdk/metrics_agentos.py` and `cookbook/frameworks/codex/codex_metrics_agentos.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/frameworks/codex/codex_metrics_agentos.py:128` calls `get` and `cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:132` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21–22 lines × 2) libs/agno/agno/agent/_run.py:1915 — libs/agno/agno/agent/_run.py:1915-1935 | libs/agno/agno/agent/_run.py:5161-5182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5157` calls `create_run_error_event`, `str`, `error_type_of` and `libs/agno/agno/agent/_run.py:1912` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21–22 lines × 2) libs/agno/agno/agent/_run.py:4645 — libs/agno/agno/agent/_run.py:4645-4665 | libs/agno/agno/team/_run.py:9103-9124 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21–22 lines × 2) REDACTED:194 — REDACTED:194-214 | REDACTED:243-264 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (21–22 lines × 2) libs/agno/agno/team/_default_tools.py:982 — libs/agno/agno/team/_default_tools.py:982-1003 | libs/agno/agno/team/_task_tools.py:773-793 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:982` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21–22 lines × 2) REDACTED:228 — REDACTED:228-248 | REDACTED:956-977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:956` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21–22 lines × 2) REDACTED:1167 — REDACTED:1167-1187 | REDACTED:1075-1096 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1075` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20 lines × 4) · ×7
  • Duplicated block (20 lines × 4) libs/agno/agno/agent/_messages.py:1634 — libs/agno/agno/agent/_messages.py:1634-1653 | libs/agno/agno/agent/_messages.py:1804-1823 | libs/agno/agno/team/_messages.py:1311-1330 | libs/agno/agno/team/_messages.py:1470-1489 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1634` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 4) libs/agno/agno/agent/_messages.py:2586 — libs/agno/agno/agent/_messages.py:2586-2605 | libs/agno/agno/agent/_messages.py:2694-2713 | libs/agno/agno/team/_default_tools.py:1807-1826 | libs/agno/agno/team/_default_tools.py:1910-1929 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (20 lines × 4) libs/agno/agno/agent/remote.py:311 — libs/agno/agno/agent/remote.py:311-330 | libs/agno/agno/agent/remote.py:333-352 | libs/agno/agno/team/remote.py:304-323 | libs/agno/agno/team/remote.py:326-345 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/remote.py:311` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 4) libs/agno/agno/db/mysql/mysql.py:1818 — libs/agno/agno/db/mysql/mysql.py:1818-1837 | libs/agno/agno/db/postgres/postgres.py:2695-2714 | libs/agno/agno/db/singlestore/singlestore.py:1842-1861 | REDACTED:2602-2621 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 4) libs/agno/agno/models/google/gemini.py:584 — libs/agno/agno/models/google/gemini.py:584-603 | libs/agno/agno/models/google/gemini.py:639-658 | libs/agno/agno/models/google/gemini.py:699-718 | libs/agno/agno/models/google/gemini.py:757-776 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (20 lines × 4) libs/agno/agno/models/groq/groq.py:465 — libs/agno/agno/models/groq/groq.py:465-484 | libs/agno/agno/models/huggingface/huggingface.py:392-411 | libs/agno/agno/models/ibm/watsonx.py:330-349 | libs/agno/agno/models/openai/chat.py:768-787 — before extracting anything, compare `libs/agno/agno/models/groq/groq.py` and `libs/agno/agno/models/openai/chat.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (20 lines × 4) libs/agno/agno/workflow/workflow.py:7084 — libs/agno/agno/workflow/workflow.py:7084-7103 | libs/agno/agno/workflow/workflow.py:7943-7962 | libs/agno/agno/workflow/workflow.py:9142-9161 | libs/agno/agno/workflow/workflow.py:9702-9721 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–18 lines × 4) · ×7
  • Duplicated block (17–18 lines × 4) libs/agno/agno/agent/_run.py:2370 — libs/agno/agno/agent/_run.py:2370-2387 | libs/agno/agno/agent/_run.py:5513-5530 | libs/agno/agno/team/_run.py:10166-10182 | libs/agno/agno/team/_run.py:10286-10302 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_run.py:2388` calls `isinstance` and `libs/agno/agno/team/_run.py:10183` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17–18 lines × 4) REDACTED:297 — REDACTED:297-314 | REDACTED:622-638 | REDACTED:259-276 | REDACTED:592-608 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 4) libs/agno/agno/db/mysql/mysql.py:2509 — libs/agno/agno/db/mysql/mysql.py:2509-2525 | libs/agno/agno/db/postgres/postgres.py:3454-3471 | libs/agno/agno/db/singlestore/singlestore.py:2504-2520 | REDACTED:3315-3331 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7070 — libs/agno/agno/db/postgres/async_postgres.py:7070-7087 | libs/agno/agno/db/postgres/postgres.py:9798-9814 | REDACTED:6239-6256 | REDACTED:8727-8743 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:7070` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 4) REDACTED:251 — REDACTED:251-267 | REDACTED:300-316 | REDACTED:350-367 | REDACTED:404-420 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:300` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–18 lines × 4) libs/agno/agno/workflow/workflow.py:3415 — libs/agno/agno/workflow/workflow.py:3415-3432 | libs/agno/agno/workflow/workflow.py:4444-4461 | libs/agno/agno/workflow/workflow.py:8258-8274 | libs/agno/agno/workflow/workflow.py:10018-10034 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17–18 lines × 4) libs/agno/agno/workflow/workflow.py:7298 — libs/agno/agno/workflow/workflow.py:7298-7315 | libs/agno/agno/workflow/workflow.py:8245-8261 | libs/agno/agno/workflow/workflow.py:9348-9365 | libs/agno/agno/workflow/workflow.py:10005-10021 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:8245` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×7
  • Duplicated block (17 lines × 4) libs/agno/agno/agent/_default_tools.py:601 — libs/agno/agno/agent/_default_tools.py:601-617 | libs/agno/agno/agent/_default_tools.py:660-676 | libs/agno/agno/team/_default_tools.py:373-389 | libs/agno/agno/team/_default_tools.py:422-438 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 4) libs/agno/agno/agent/_run.py:1218 — libs/agno/agno/agent/_run.py:1218-1234 | libs/agno/agno/agent/_run.py:2579-2595 | libs/agno/agno/agent/_run.py:4107-4123 | libs/agno/agno/agent/_run.py:5694-5710 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:4105` calls `cast` and `libs/agno/agno/agent/_run.py:1216` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 4) libs/agno/agno/agent/_run.py:1635 — libs/agno/agno/agent/_run.py:1635-1651 | libs/agno/agno/agent/_run.py:2252-2268 | libs/agno/agno/agent/_run.py:4908-4924 | libs/agno/agno/agent/_run.py:5427-5443 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 4) libs/agno/agno/workflow/condition.py:567 — libs/agno/agno/workflow/condition.py:567-583 | libs/agno/agno/workflow/condition.py:1022-1038 | libs/agno/agno/workflow/steps.py:286-302 | libs/agno/agno/workflow/steps.py:592-608 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/steps.py` as WHOLE FILES: this scan already matched 19 separate duplicated blocks between them, totalling at least 261 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:567` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 4) libs/agno/agno/workflow/step.py:1335 — libs/agno/agno/workflow/step.py:1335-1351 | libs/agno/agno/workflow/step.py:1749-1765 | libs/agno/agno/workflow/step.py:2056-2072 | libs/agno/agno/workflow/step.py:2476-2492 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 4) libs/agno/agno/workflow/steps.py:351 — libs/agno/agno/workflow/steps.py:351-367 | libs/agno/agno/workflow/steps.py:525-541 | libs/agno/agno/workflow/steps.py:656-672 | libs/agno/agno/workflow/steps.py:829-845 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/steps.py:351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 4) libs/agno/agno/workflow/workflow.py:6979 — libs/agno/agno/workflow/workflow.py:6979-6995 | libs/agno/agno/workflow/workflow.py:7838-7854 | libs/agno/agno/workflow/workflow.py:9054-9070 | libs/agno/agno/workflow/workflow.py:9598-9614 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×7
  • Duplicated block (8–10 lines × 2) libs/agno/agno/agent/_storage.py:504 — libs/agno/agno/agent/_storage.py:504-513 | libs/agno/agno/agent/_storage.py:553-560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–10 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:1950 — libs/agno/agno/db/dynamo/dynamo.py:1950-1957 | libs/agno/agno/db/dynamo/utils.py:69-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8–10 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1174 — libs/agno/agno/db/mongo/async_mongo.py:1174-1183 | libs/agno/agno/db/mongo/mongo.py:984-991 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1174` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–10 lines × 2) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:162 — libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:162-169 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:288-297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–10 lines × 2) libs/agno/agno/os/routers/components/components.py:1196 — libs/agno/agno/os/routers/components/components.py:1196-1203 | libs/agno/agno/os/routers/components/components.py:1262-1271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/components/components.py:1196` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–10 lines × 2) libs/agno/agno/os/routers/workflows/router.py:1391 — libs/agno/agno/os/routers/workflows/router.py:1391-1398 | libs/agno/agno/workflow/workflow.py:5286-5295 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/workflows/router.py:1391` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–10 lines × 2) libs/agno/agno/tools/shell.py:62 — libs/agno/agno/tools/shell.py:62-69 | libs/agno/agno/utils/shell.py:14-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×7
  • Duplicated block (7–8 lines × 2) REDACTED:3604 — REDACTED:3604-3611 | REDACTED:4376-4382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3604` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6330 — libs/agno/agno/db/postgres/async_postgres.py:6330-6337 | REDACTED:5501-5507 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6330` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) libs/agno/agno/db/postgres/postgres.py:9083 — libs/agno/agno/db/postgres/postgres.py:9083-9090 | REDACTED:8014-8020 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:9083` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) libs/agno/agno/models/anthropic/claude.py:1100 — libs/agno/agno/models/anthropic/claude.py:1100-1107 | libs/agno/agno/models/anthropic/claude.py:1277-1283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) libs/agno/agno/models/openai/chat.py:598 — libs/agno/agno/models/openai/chat.py:598-604 | libs/agno/agno/models/openai/chat.py:685-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/openai/chat.py:685` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) libs/agno/agno/os/routers/agents/router.py:1449 — libs/agno/agno/os/routers/agents/router.py:1449-1456 | libs/agno/agno/os/routers/workflows/router.py:2252-2258 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/workflows/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 17 separate duplicated blocks between them, totalling at least 413 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1449` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) REDACTED:456 — REDACTED:456-463 | REDACTED:516-522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×7
  • Duplicated block (6 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3644 — libs/agno/agno/db/postgres/async_postgres.py:3644-3649 | libs/agno/agno/db/postgres/postgres.py:4186-4191 | REDACTED:3793-3798 | REDACTED:3992-3997 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6102 — libs/agno/agno/db/postgres/async_postgres.py:6102-6107 | libs/agno/agno/db/postgres/postgres.py:8861-8868 | REDACTED:5271-5278 | REDACTED:7792-7799 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6610 — libs/agno/agno/db/postgres/async_postgres.py:6610-6615 | libs/agno/agno/db/postgres/async_postgres.py:6745-6750 | REDACTED:5779-5784 | REDACTED:5914-5919 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6726 — libs/agno/agno/db/postgres/async_postgres.py:6726-6731 | libs/agno/agno/db/postgres/postgres.py:9471-9476 | REDACTED:5895-5900 | REDACTED:8400-8405 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 4) libs/agno/agno/db/postgres/postgres.py:7494 — libs/agno/agno/db/postgres/postgres.py:7494-7499 | libs/agno/agno/db/postgres/postgres.py:8879-8884 | REDACTED:7279-7284 | REDACTED:7810-7815 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 4) libs/agno/agno/team/_run.py:2466 — libs/agno/agno/team/_run.py:2466-2471 | libs/agno/agno/team/_run.py:3015-3020 | libs/agno/agno/team/_run.py:9787-9792 | libs/agno/agno/team/_run.py:10503-10508 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 4) libs/agno/agno/tools/gitlab.py:288 — libs/agno/agno/tools/gitlab.py:288-293 | libs/agno/agno/tools/gitlab.py:361-366 | libs/agno/agno/tools/gitlab.py:437-442 | libs/agno/agno/tools/gitlab.py:515-520 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
X3 · Exception handling · Swallowed exception (empty catch) · ×7
  • Swallowed exception (empty catch) libs/agnoctl/agnoctl/http.py:96 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) libs/agno/agno/utils/agent.py:228 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) REDACTED:319 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) REDACTED:331 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) libs/agno/agno/tools/coding.py:428 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) libs/agno/agno/tools/function.py:643 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) libs/agno/agno/tools/function.py:1503 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
D29 · Static Analysis (SAST) · REDACTED · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×6
  • Duplicated block (41 lines × 2) cookbook/02_agents/08_guardrails/pii_detection.py:29 — cookbook/02_agents/08_guardrails/pii_detection.py:29-69 | cookbook/02_agents/08_guardrails/prompt_injection.py:27-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/08_guardrails/pii_detection.py:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (41 lines × 2) libs/agno/agno/agent/_tools.py:481 — libs/agno/agno/agent/_tools.py:481-521 | libs/agno/agno/team/_tools.py:340-380 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:481` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (41 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2385 — libs/agno/agno/db/postgres/async_postgres.py:2385-2425 | libs/agno/agno/db/postgres/postgres.py:2917-2957 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (41 lines × 2) libs/agno/agno/tools/spotify.py:113 — libs/agno/agno/tools/spotify.py:113-153 | libs/agno/agno/tools/spotify.py:160-200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (41 lines × 2) REDACTED:625 — REDACTED:625-665 | REDACTED:865-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (41 lines × 2) cookbook/04_workflows/08_human_in_the_loop/executor_hitl/04_agent_confirmation_in_condition_step.py:46 — cookbook/04_workflows/08_human_in_the_loop/executor_hitl/04_agent_confirmation_in_condition_step.py:46-86 | cookbook/04_workflows/08_human_in_the_loop/executor_hitl/07_agent_confirmation_in_router_step.py:48-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×6
  • Duplicated block (39 lines × 2) libs/agno/agno/db/redis/redis.py:1141 — libs/agno/agno/db/redis/redis.py:1141-1179 | libs/agno/agno/db/valkey/valkey.py:1435-1473 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:1141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (39 lines × 2) REDACTED:1481 — REDACTED:1481-1519 | REDACTED:1762-1800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1481` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (39 lines × 2) libs/agno/agno/os/interfaces/a2a/router.py:366 — libs/agno/agno/os/interfaces/a2a/router.py:366-404 | libs/agno/agno/os/interfaces/a2a/router.py:693-731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (39 lines × 2) libs/agno/agno/team/_default_tools.py:557 — libs/agno/agno/team/_default_tools.py:557-595 | libs/agno/agno/team/_default_tools.py:634-672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (39 lines × 2) libs/agno/agno/workflow/agent.py:121 — libs/agno/agno/workflow/agent.py:121-159 | libs/agno/agno/workflow/agent.py:243-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (39 lines × 2) libs/agno/agno/workflow/step.py:1653 — libs/agno/agno/workflow/step.py:1653-1691 | libs/agno/agno/workflow/step.py:2380-2418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35–36 lines × 2) · ×6
  • Duplicated block (35–36 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2566 — libs/agno/agno/db/postgres/async_postgres.py:2566-2600 | REDACTED:2760-2795 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35–36 lines × 2) REDACTED:847 — REDACTED:847-882 | REDACTED:1071-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35–36 lines × 2) libs/agno/agno/os/routers/agents/router.py:1868 — libs/agno/agno/os/routers/agents/router.py:1868-1903 | libs/agno/agno/os/routers/agents/router.py:1984-2018 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (35–36 lines × 2) libs/agno/agno/team/_run.py:912 — libs/agno/agno/team/_run.py:912-946 | libs/agno/agno/team/_run.py:1703-1738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1703` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:1739` calls `merge_background_metrics`, `collect_background_metrics` and `libs/agno/agno/team/_run.py:948` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (35–36 lines × 2) libs/agno/agno/workflow/step.py:1190 — libs/agno/agno/workflow/step.py:1190-1224 | libs/agno/agno/workflow/step.py:1902-1937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (35–36 lines × 2) libs/agno_infra/agno/cli/infra_cli.py:186 — libs/agno_infra/agno/cli/infra_cli.py:186-220 | libs/agno_infra/agno/cli/infra_cli.py:375-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (33–34 lines × 2) · ×6
  • Duplicated block (33–34 lines × 2) REDACTED:1578 — REDACTED:1578-1611 | REDACTED:1860-1892 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33–34 lines × 2) libs/agno/agno/os/routers/agents/router.py:955 — libs/agno/agno/os/routers/agents/router.py:955-988 | libs/agno/agno/os/routers/teams/router.py:862-894 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:955` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (33–34 lines × 2) libs/agno/agno/team/_run.py:1792 — libs/agno/agno/team/_run.py:1792-1825 | libs/agno/agno/team/_run.py:8550-8582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:1786` calls `generate_team_followups_stream` and `libs/agno/agno/team/_run.py:8547` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (33–34 lines × 2) libs/agno/agno/tools/function.py:2631 — libs/agno/agno/tools/function.py:2631-2663 | libs/agno/agno/tools/function.py:2913-2946 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/function.py:2913` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33–34 lines × 2) REDACTED:1341 — REDACTED:1341-1373 | REDACTED:1254-1287 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1374` calls `_require_preparable` and `REDACTED:1288` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (33–34 lines × 2) libs/agno/agno/workflow/workflow.py:7620 — libs/agno/agno/workflow/workflow.py:7620-7653 | libs/agno/agno/workflow/workflow.py:7710-7742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–27 lines × 2) · ×6
  • Duplicated block (24–27 lines × 2) cookbook/05_agent_os/04_run_lifecycle/background_run.py:84 — cookbook/05_agent_os/04_run_lifecycle/background_run.py:84-107 | cookbook/05_agent_os/04_run_lifecycle/cancel_run.py:88-114 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (24–27 lines × 2) libs/agno/agno/agent/_run.py:1382 — libs/agno/agno/agent/_run.py:1382-1405 | libs/agno/agno/agent/_run.py:2765-2791 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24–27 lines × 2) libs/agno/agno/agent/_run.py:2483 — libs/agno/agno/agent/_run.py:2483-2509 | libs/agno/agno/agent/_run.py:5602-5625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2483` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24–27 lines × 2) libs/agno/agno/learn/migrations.py:343 — libs/agno/agno/learn/migrations.py:343-369 | libs/agno/agno/learn/migrations.py:465-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/migrations.py:343` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24–27 lines × 2) libs/agno/agno/team/_run.py:6477 — libs/agno/agno/team/_run.py:6477-6500 | libs/agno/agno/team/_run.py:6674-6700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24–27 lines × 2) REDACTED:2805 — REDACTED:2805-2828 | REDACTED:2193-2219 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×6
  • Duplicated block (23–25 lines × 2) libs/agno/agno/os/routers/teams/router.py:1162 — libs/agno/agno/os/routers/teams/router.py:1162-1184 | libs/agno/agno/os/routers/teams/router.py:1214-1238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/teams/router.py:1162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–25 lines × 2) libs/agno/agno/os/routers/workflows/router.py:2581 — libs/agno/agno/os/routers/workflows/router.py:2581-2603 | libs/agno/agno/os/routers/workflows/router.py:2633-2657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/workflows/router.py:2581` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–25 lines × 2) libs/agno/agno/session/agent.py:100 — libs/agno/agno/session/agent.py:100-122 | libs/agno/agno/session/team.py:104-128 — before extracting anything, compare `libs/agno/agno/session/agent.py` and `libs/agno/agno/session/team.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23–25 lines × 2) libs/agno/agno/team/_run.py:980 — libs/agno/agno/team/_run.py:980-1002 | libs/agno/agno/team/_run.py:1777-1801 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:980` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–25 lines × 2) libs/agno/agno/team/_run.py:1745 — libs/agno/agno/team/_run.py:1745-1769 | libs/agno/agno/team/_run.py:8516-8538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1745` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–25 lines × 2) libs/agno/agno/team/_run.py:3946 — libs/agno/agno/team/_run.py:3946-3970 | libs/agno/agno/team/_run.py:10354-10376 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:3946` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:3941` calls `merge_background_metrics`, `collect_background_metrics`, `araise_if_cancelled` and `libs/agno/agno/team/_run.py:10351` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22 lines × 4) · ×6
  • Duplicated block (22 lines × 4) libs/agno/agno/agent/_response.py:259 — libs/agno/agno/agent/_response.py:259-280 | libs/agno/agno/agent/_response.py:296-317 | libs/agno/agno/team/_response.py:733-754 | libs/agno/agno/team/_response.py:768-789 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `TeamRunOutput` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (22 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4072 — libs/agno/agno/db/postgres/async_postgres.py:4072-4093 | libs/agno/agno/db/postgres/postgres.py:6804-6825 | REDACTED:4207-4228 | REDACTED:6575-6596 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:4072` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 4) REDACTED:825 — REDACTED:825-846 | REDACTED:1048-1069 | REDACTED:1556-1577 | REDACTED:1837-1858 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:825` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 4) libs/agno/agno/utils/print_response/agent.py:62 — libs/agno/agno/utils/print_response/agent.py:62-83 | libs/agno/agno/utils/print_response/agent.py:269-290 | libs/agno/agno/utils/print_response/team.py:414-435 | libs/agno/agno/utils/print_response/team.py:1348-1369 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 4) REDACTED:273 — REDACTED:273-294 | REDACTED:350-371 | REDACTED:712-733 | REDACTED:809-830 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:272` calls `embed` and `REDACTED:711` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 4) libs/agno/agno/workflow/workflow.py:7012 — libs/agno/agno/workflow/workflow.py:7012-7033 | libs/agno/agno/workflow/workflow.py:7860-7881 | libs/agno/agno/workflow/workflow.py:9075-9096 | libs/agno/agno/workflow/workflow.py:9620-9641 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (18–19 lines × 3) · ×6
  • Duplicated block (18–19 lines × 3) libs/agno/agno/db/mongo/async_mongo.py:1401 — libs/agno/agno/db/mongo/async_mongo.py:1401-1419 | libs/agno/agno/db/mysql/async_mysql.py:1529-1546 | REDACTED:2045-2062 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 3) libs/agno/agno/db/mongo/mongo.py:1211 — libs/agno/agno/db/mongo/mongo.py:1211-1229 | libs/agno/agno/db/mysql/mysql.py:1510-1527 | REDACTED:2302-2319 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–19 lines × 3) libs/agno/agno/os/routers/agents/router.py:2220 — libs/agno/agno/os/routers/agents/router.py:2220-2237 | libs/agno/agno/os/routers/agents/router.py:2382-2400 | libs/agno/agno/os/routers/agents/router.py:2568-2585 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 3) libs/agno/agno/os/routers/teams/router.py:2106 — libs/agno/agno/os/routers/teams/router.py:2106-2123 | libs/agno/agno/os/routers/teams/router.py:2265-2283 | libs/agno/agno/os/routers/teams/router.py:2329-2346 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/teams/router.py:2106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 3) libs/agno/agno/os/utils.py:3001 — libs/agno/agno/os/utils.py:3001-3019 | libs/agno/agno/os/utils.py:3088-3105 | libs/agno/agno/os/utils.py:3169-3186 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/utils.py:3001` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 3) libs/agno/agno/os/utils.py:3024 — libs/agno/agno/os/utils.py:3024-3042 | libs/agno/agno/os/utils.py:3111-3128 | libs/agno/agno/os/utils.py:3192-3209 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/utils.py:3024` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×6
  • Duplicated block (15 lines × 3) cookbook/02_agents/14_advanced/cancel_run.py:103 — cookbook/02_agents/14_advanced/cancel_run.py:103-117 | cookbook/03_teams/14_run_control/cancel_run.py:103-117 | cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py:102-116 — before extracting anything, compare `cookbook/02_agents/14_advanced/cancel_run.py` and `cookbook/03_teams/14_run_control/cancel_run.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cookbook/02_agents/14_advanced/cancel_run.py:123` calls `main` and `cookbook/03_teams/14_run_control/cancel_run.py:123` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1889 — libs/agno/agno/db/mysql/async_mysql.py:1889-1903 | libs/agno/agno/db/mysql/mysql.py:1863-1877 | libs/agno/agno/db/singlestore/singlestore.py:1887-1901 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1889` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:386 — libs/agno/agno/os/interfaces/a2a/router.py:386-400 | libs/agno/agno/os/interfaces/a2a/router.py:713-727 | libs/agno/agno/os/interfaces/a2a/router.py:924-938 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:386` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 3) libs/agno/agno/tools/google/calendar.py:147 — libs/agno/agno/tools/google/calendar.py:147-161 | libs/agno/agno/tools/google/gmail.py:308-322 | libs/agno/agno/tools/google/slides.py:169-183 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (15 lines × 3) REDACTED:166 — REDACTED:166-180 | libs/agno/agno/vectordb/redis/redisdb.py:110-124 | libs/agno/agno/vectordb/valkey/valkeydb.py:180-194 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:163` calls `MetaData` and `libs/agno/agno/vectordb/valkey/valkeydb.py:177` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 3) libs/agno/agno/workflow/workflow.py:7819 — libs/agno/agno/workflow/workflow.py:7819-7833 | libs/agno/agno/workflow/workflow.py:9037-9051 | libs/agno/agno/workflow/workflow.py:9579-9593 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×6
  • Duplicated block (12–14 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2090 — libs/agno/agno/db/mysql/async_mysql.py:2090-2103 | REDACTED:2619-2630 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2090` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–14 lines × 2) libs/agno/agno/db/postgres/utils.py:233 — libs/agno/agno/db/postgres/utils.py:233-246 | libs/agno/agno/db/sqlite/utils.py:197-208 — `libs/agno/agno/db/postgres/utils.py` and `libs/agno/agno/db/sqlite/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 213 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/utils.py:233` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12–14 lines × 2) libs/agno/agno/knowledge/knowledge.py:3535 — libs/agno/agno/knowledge/knowledge.py:3535-3548 | libs/agno/agno/knowledge/knowledge.py:3730-3741 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/knowledge.py:3535` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–14 lines × 2) libs/agno/agno/learn/stores/user_memory.py:1243 — libs/agno/agno/learn/stores/user_memory.py:1243-1254 | libs/agno/agno/learn/stores/user_memory.py:1393-1406 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/user_memory.py:1393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–14 lines × 2) libs/agno/agno/learn/stores/user_memory.py:1284 — libs/agno/agno/learn/stores/user_memory.py:1284-1295 | libs/agno/agno/learn/stores/user_memory.py:1436-1449 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/user_memory.py:1436` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–14 lines × 2) libs/agno/agno/tools/parallel.py:193 — libs/agno/agno/tools/parallel.py:193-204 | libs/agno/agno/tools/parallel.py:289-302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×6
  • Duplicated block (9–11 lines × 3) cookbook/07_knowledge/09_archive/vector_dbs/milvus_db_range_search.py:62 — cookbook/07_knowledge/09_archive/vector_dbs/milvus_db_range_search.py:62-70 | cookbook/07_knowledge/09_archive/vector_dbs/milvus_db_range_search.py:75-85 | cookbook/07_knowledge/09_archive/vector_dbs/milvus_db_range_search.py:90-98 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/07_knowledge/09_archive/vector_dbs/milvus_db_range_search.py:62` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:213 — libs/agno/agno/db/mysql/async_mysql.py:213-221 | libs/agno/agno/db/mysql/mysql.py:206-216 | libs/agno/agno/db/singlestore/singlestore.py:273-283 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:211` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:206` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9–11 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1595 — libs/agno/agno/db/mysql/async_mysql.py:1595-1604 | libs/agno/agno/db/postgres/async_postgres.py:1976-1986 | REDACTED:3075-3083 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9–11 lines × 3) libs/agno/agno/db/mysql/mysql.py:878 — libs/agno/agno/db/mysql/mysql.py:878-886 | libs/agno/agno/db/postgres/postgres.py:1426-1436 | libs/agno/agno/db/singlestore/singlestore.py:932-940 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/postgres.py:1424` calls `_collect_sandbox_leftovers` and `libs/agno/agno/db/mysql/mysql.py:876` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9–11 lines × 3) libs/agno/agno/db/postgres/postgres.py:2435 — libs/agno/agno/db/postgres/postgres.py:2435-2445 | libs/agno/agno/db/singlestore/singlestore.py:2517-2525 | REDACTED:3328-3336 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9–11 lines × 3) libs/agno/agno/workflow/workflow.py:2967 — libs/agno/agno/workflow/workflow.py:2967-2975 | libs/agno/agno/workflow/workflow.py:3256-3266 | libs/agno/agno/workflow/workflow.py:3322-3330 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D6 · Cohesion (LCOM4) · Low cohesion · ×6
  • Low cohesion: GmailTools (LCOM4 17) libs/agno/agno/tools/google/gmail.py:131 — GmailTools's methods fall into 17 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 17 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: InMemoryDb (LCOM4 5) libs/agno/agno/db/in_memory/in_memory_db.py:32 — InMemoryDb's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PageFileSystem (LCOM4 4) libs/agno/agno/knowledge/page/filesystem.py:22 — PageFileSystem's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GoogleSheetsTools (LCOM4 4) libs/agno/agno/tools/google/sheets.py:67 — GoogleSheetsTools's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Elasticsearch (LCOM4 4) REDACTED:45 — Elasticsearch's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: OpenSearch (LCOM4 4) REDACTED:36 — OpenSearch's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×5
  • Duplicated block (42 lines × 2) cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py:73 — cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py:73-114 | cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py:72-113 — before extracting anything, compare `cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py` and `cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (42 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:2899 — libs/agno/agno/db/mongo/async_mongo.py:2899-2940 | libs/agno/agno/db/mongo/mongo.py:2763-2804 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (42 lines × 2) libs/agno/agno/db/redis/redis.py:1636 — libs/agno/agno/db/redis/redis.py:1636-1677 | libs/agno/agno/db/valkey/valkey.py:2022-2063 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (42 lines × 2) libs/agno/agno/models/google/gemini.py:1035 — libs/agno/agno/models/google/gemini.py:1035-1076 | libs/agno/agno/models/google/gemini.py:1088-1129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/google/gemini.py:1035` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (42 lines × 2) libs/agno/agno/utils/print_response/team.py:816 — libs/agno/agno/utils/print_response/team.py:816-857 | libs/agno/agno/utils/print_response/team.py:1765-1806 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (37–38 lines × 2) · ×5
  • Duplicated block (37–38 lines × 2) libs/agno/agno/agent/_default_tools.py:38 — libs/agno/agno/agent/_default_tools.py:38-74 | libs/agno/agno/team/_default_tools.py:123-160 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: `Agent` names `agno.agent` in one and `agno.agent.agent` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (37–38 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1961 — libs/agno/agno/db/mysql/async_mysql.py:1961-1997 | REDACTED:2464-2501 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37–38 lines × 2) libs/agno/agno/db/mysql/mysql.py:1311 — libs/agno/agno/db/mysql/mysql.py:1311-1347 | REDACTED:2069-2106 — `libs/agno/agno/db/mysql/mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 102 separate duplicated blocks between them, totalling at least 1766 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37–38 lines × 2) libs/agno/agno/eval/accuracy.py:428 — libs/agno/agno/eval/accuracy.py:428-465 | libs/agno/agno/eval/accuracy.py:570-606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/eval/accuracy.py:428` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37–38 lines × 2) libs/agno/agno/workflow/workflow.py:5800 — libs/agno/agno/workflow/workflow.py:5800-5836 | libs/agno/agno/workflow/workflow.py:6205-6242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:6205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (34–35 lines × 2) · ×5
  • Duplicated block (34–35 lines × 2) libs/agno/agno/agent/_run.py:1593 — libs/agno/agno/agent/_run.py:1593-1627 | libs/agno/agno/agent/_run.py:2209-2242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1593` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (34–35 lines × 2) libs/agno/agno/db/mysql/mysql.py:1913 — libs/agno/agno/db/mysql/mysql.py:1913-1947 | REDACTED:2701-2734 — `libs/agno/agno/db/mysql/mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 102 separate duplicated blocks between them, totalling at least 1766 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34–35 lines × 2) libs/agno/agno/tools/serply.py:102 — libs/agno/agno/tools/serply.py:102-135 | libs/agno/agno/tools/serply.py:175-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34–35 lines × 2) libs/agno/agno/utils/media_offload.py:228 — libs/agno/agno/utils/media_offload.py:228-262 | libs/agno/agno/utils/media_offload.py:437-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (34–35 lines × 2) libs/agno/agno/utils/print_response/team.py:666 — libs/agno/agno/utils/print_response/team.py:666-699 | libs/agno/agno/utils/print_response/team.py:1597-1631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (27–29 lines × 2) · ×5
  • Duplicated block (27–29 lines × 2) cookbook/02_agents/14_advanced/background_execution.py:100 — cookbook/02_agents/14_advanced/background_execution.py:100-128 | cookbook/03_teams/14_run_control/background_execution.py:129-155 — before extracting anything, compare `cookbook/02_agents/14_advanced/background_execution.py` and `cookbook/03_teams/14_run_control/background_execution.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/14_advanced/background_execution.py:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27–29 lines × 2) libs/agno/agno/learn/stores/learned_knowledge.py:578 — libs/agno/agno/learn/stores/learned_knowledge.py:578-606 | libs/agno/agno/learn/stores/learned_knowledge.py:1295-1321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27–29 lines × 2) libs/agno/agno/learn/stores/learned_knowledge.py:623 — libs/agno/agno/learn/stores/learned_knowledge.py:623-651 | libs/agno/agno/learn/stores/learned_knowledge.py:1336-1362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27–29 lines × 2) libs/agno/agno/tools/whatsapp.py:125 — libs/agno/agno/tools/whatsapp.py:125-151 | libs/agno/agno/tools/whatsapp.py:473-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27–29 lines × 2) libs/agno_infra/agno/aws/app/streamlit/streamlit.py:45 — libs/agno_infra/agno/aws/app/streamlit/streamlit.py:45-73 | libs/agno_infra/agno/docker/app/streamlit/streamlit.py:41-67 — before extracting anything, compare `libs/agno_infra/agno/aws/app/streamlit/streamlit.py` and `libs/agno_infra/agno/docker/app/streamlit/streamlit.py` as WHOLE FILES: 86% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/app/streamlit/streamlit.py:45` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (23 lines × 3) · ×5
  • Duplicated block (23 lines × 3) libs/agno/agno/agent/_response.py:1607 — libs/agno/agno/agent/_response.py:1607-1629 | libs/agno/agno/team/_response.py:1560-1582 | libs/agno/agno/utils/agent.py:367-389 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (23 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:1886 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1886-1908 | libs/agno/agno/db/json/json_db.py:1983-2005 | libs/agno/agno/db/redis/redis.py:2273-2295 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 3) libs/agno/agno/learn/stores/session_context.py:280 — libs/agno/agno/learn/stores/session_context.py:280-302 | libs/agno/agno/learn/stores/user_memory.py:438-460 | libs/agno/agno/learn/stores/user_profile.py:606-628 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 3) libs/agno/agno/team/_run.py:2843 — libs/agno/agno/team/_run.py:2843-2865 | libs/agno/agno/team/_run.py:3905-3927 | libs/agno/agno/team/_run.py:10329-10351 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (23 lines × 3) libs/agno/agno/workflow/workflow.py:7460 — libs/agno/agno/workflow/workflow.py:7460-7482 | libs/agno/agno/workflow/workflow.py:8517-8539 | libs/agno/agno/workflow/workflow.py:9506-9528 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21 lines × 4) · ×5
  • Duplicated block (21 lines × 4) libs/agno/agno/agent/_response.py:1103 — libs/agno/agno/agent/_response.py:1103-1123 | libs/agno/agno/agent/_response.py:1269-1289 | libs/agno/agno/team/_response.py:1055-1075 | libs/agno/agno/team/_response.py:1217-1237 — `libs/agno/agno/agent/_response.py` and `libs/agno/agno/team/_response.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 21 separate duplicated blocks between them, totalling at least 335 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_response.py:1103` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 4) libs/agno/agno/db/mongo/async_mongo.py:2959 — libs/agno/agno/db/mongo/async_mongo.py:2959-2979 | libs/agno/agno/db/mongo/mongo.py:2823-2843 | libs/agno/agno/db/mysql/async_mysql.py:3207-3227 | libs/agno/agno/db/mysql/mysql.py:3169-3189 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:4381 — libs/agno/agno/db/postgres/async_postgres.py:4381-4401 | libs/agno/agno/db/postgres/postgres.py:7110-7130 | REDACTED:4453-4473 | REDACTED:6878-6898 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (21 lines × 4) libs/agno/agno/team/_run.py:2216 — libs/agno/agno/team/_run.py:2216-2236 | libs/agno/agno/team/_run.py:2599-2619 | libs/agno/agno/team/_run.py:3193-3213 | libs/agno/agno/team/_run.py:3768-3788 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:3215` calls `cast` and `libs/agno/agno/team/_run.py:2239` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21 lines × 4) libs/agno/agno/workflow/condition.py:718 — libs/agno/agno/workflow/condition.py:718-738 | libs/agno/agno/workflow/condition.py:771-791 | libs/agno/agno/workflow/condition.py:1171-1191 | libs/agno/agno/workflow/condition.py:1224-1244 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×5
  • Duplicated block (21 lines × 3) libs/agno/agno/agent/agent.py:1900 — libs/agno/agno/agent/agent.py:1900-1920 | libs/agno/agno/team/team.py:1930-1950 | libs/agno/agno/workflow/workflow.py:11961-11981 — `libs/agno/agno/agent/agent.py` and `libs/agno/agno/team/team.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:1525 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1525-1545 | libs/agno/agno/db/in_memory/in_memory_db.py:1342-1362 | libs/agno/agno/db/json/json_db.py:1625-1645 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (21 lines × 3) libs/agno/agno/db/mysql/mysql.py:1812 — libs/agno/agno/db/mysql/mysql.py:1812-1832 | libs/agno/agno/db/postgres/postgres.py:2689-2709 | libs/agno/agno/db/singlestore/singlestore.py:1836-1856 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1812` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 3) libs/agno/agno/knowledge/loaders/azure_blob.py:392 — libs/agno/agno/knowledge/loaders/azure_blob.py:392-412 | libs/agno/agno/knowledge/loaders/github.py:597-617 | libs/agno/agno/knowledge/loaders/sharepoint.py:409-429 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 3) libs/agno/agno/workflow/workflow.py:8199 — libs/agno/agno/workflow/workflow.py:8199-8219 | libs/agno/agno/workflow/workflow.py:9317-9337 | libs/agno/agno/workflow/workflow.py:9959-9979 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×5
  • Duplicated block (20–21 lines × 2) cookbook/10_reasoning/models/anthropic/basic_reasoning.py:34 — cookbook/10_reasoning/models/anthropic/basic_reasoning.py:34-54 | cookbook/10_reasoning/models/gemini/basic_reasoning.py:32-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/10_reasoning/models/anthropic/basic_reasoning.py:34` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–21 lines × 2) libs/agno/agno/db/postgres/postgres.py:8797 — libs/agno/agno/db/postgres/postgres.py:8797-8817 | REDACTED:7729-7748 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20–21 lines × 2) libs/agno/agno/os/app.py:1018 — libs/agno/agno/os/app.py:1018-1038 | libs/agno/agno/os/app.py:1927-1946 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/app.py:1018` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–21 lines × 2) libs/agno/agno/utils/print_response/team.py:439 — libs/agno/agno/utils/print_response/team.py:439-459 | libs/agno/agno/utils/print_response/team.py:1382-1401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/team.py:439` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (20–21 lines × 2) libs/agno_infra/agno/docker/resources.py:102 — libs/agno_infra/agno/docker/resources.py:102-122 | libs/agno_infra/agno/docker/resources.py:426-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/docker/resources.py:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×5
  • Duplicated block (20 lines × 3) libs/agno/agno/db/mysql/mysql.py:2855 — libs/agno/agno/db/mysql/mysql.py:2855-2874 | libs/agno/agno/db/singlestore/singlestore.py:2796-2815 | REDACTED:3610-3629 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 3) libs/agno/agno/os/routers/agents/router.py:1087 — libs/agno/agno/os/routers/agents/router.py:1087-1106 | libs/agno/agno/os/routers/teams/router.py:990-1009 | libs/agno/agno/os/routers/workflows/router.py:2089-2108 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1087` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 3) libs/agno/agno/team/_run.py:3883 — libs/agno/agno/team/_run.py:3883-3902 | libs/agno/agno/team/_run.py:10189-10208 | libs/agno/agno/team/_run.py:10307-10326 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:3880` calls `araise_if_cancelled` and `libs/agno/agno/team/_run.py:10304` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (20 lines × 3) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:759 — libs/agno_infra/agno/aws/resource/rds/db_cluster.py:759-778 | libs/agno_infra/agno/aws/resource/rds/db_cluster.py:781-800 | libs/agno_infra/agno/aws/resource/rds/db_cluster.py:803-822 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (20 lines × 3) libs/agno/agno/db/schemas/approval.py:78 — libs/agno/agno/db/schemas/approval.py:78-107 | libs/agno/agno/db/schemas/scheduler.py:254-284 | libs/agno/agno/db/schemas/scheduler.py:338-357 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×5
  • Duplicated block (17–19 lines × 2) cookbook/04_workflows/06_advanced_concepts/previous_step_outputs/access_previous_outputs.py:66 — cookbook/04_workflows/06_advanced_concepts/previous_step_outputs/access_previous_outputs.py:66-84 | cookbook/04_workflows/06_advanced_concepts/previous_step_outputs/access_previous_outputs.py:106-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/06_advanced_concepts/previous_step_outputs/access_previous_outputs.py:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (17–19 lines × 2) libs/agno/agno/db/mysql/mysql.py:111 — libs/agno/agno/db/mysql/mysql.py:111-127 | libs/agno/agno/db/singlestore/singlestore.py:109-127 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/singlestore/singlestore.py:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (17–19 lines × 2) libs/agno/agno/knowledge/reader/website_reader.py:269 — libs/agno/agno/knowledge/reader/website_reader.py:269-285 | libs/agno/agno/knowledge/reader/website_reader.py:380-398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–19 lines × 2) libs/agno/agno/os/middleware/jwt.py:1114 — libs/agno/agno/os/middleware/jwt.py:1114-1132 | libs/agno/agno/os/middleware/jwt.py:1303-1319 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/middleware/jwt.py:1114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–19 lines × 2) libs/agno/agno/os/routers/agents/router.py:2265 — libs/agno/agno/os/routers/agents/router.py:2265-2283 | libs/agno/agno/os/routers/teams/router.py:2151-2167 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2265` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 4) · ×5
  • Duplicated block (14–15 lines × 4) libs/agno/agno/db/mysql/mysql.py:2487 — libs/agno/agno/db/mysql/mysql.py:2487-2500 | libs/agno/agno/db/postgres/postgres.py:3430-3444 | libs/agno/agno/db/singlestore/singlestore.py:2481-2494 | REDACTED:3292-3305 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3922 — libs/agno/agno/db/postgres/async_postgres.py:3922-3936 | libs/agno/agno/db/postgres/postgres.py:4461-4475 | REDACTED:4056-4069 | REDACTED:4250-4263 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14–15 lines × 4) libs/agno/agno/knowledge/embedder/azure_openai.py:210 — libs/agno/agno/knowledge/embedder/azure_openai.py:210-223 | libs/agno/agno/knowledge/embedder/mistral.py:207-221 | libs/agno/agno/knowledge/embedder/openai.py:188-201 | libs/agno/agno/knowledge/embedder/vllm.py:243-256 — before extracting anything, compare `libs/agno/agno/knowledge/embedder/azure_openai.py` and `libs/agno/agno/knowledge/embedder/openai.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/embedder/azure_openai.py:210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 4) REDACTED:719 — REDACTED:719-733 | REDACTED:943-957 | REDACTED:1478-1491 | REDACTED:1759-1772 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:719` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 4) libs/agno/agno/reasoning/manager.py:969 — libs/agno/agno/reasoning/manager.py:969-982 | libs/agno/agno/reasoning/manager.py:989-1003 | libs/agno/agno/reasoning/manager.py:1018-1031 | libs/agno/agno/reasoning/manager.py:1040-1054 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×5
  • Duplicated block (13–15 lines × 2) cookbook/frameworks/claude-agent-sdk/claude_retries.py:95 — cookbook/frameworks/claude-agent-sdk/claude_retries.py:95-109 | cookbook/frameworks/codex/codex_retries.py:111-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13–15 lines × 2) libs/agno/agno/agent/_run.py:1189 — libs/agno/agno/agent/_run.py:1189-1201 | libs/agno/agno/agent/_run.py:2547-2561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–15 lines × 2) REDACTED:2785 — REDACTED:2785-2797 | REDACTED:2860-2874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–15 lines × 2) libs/agno/agno/os/middleware/jwt.py:1692 — libs/agno/agno/os/middleware/jwt.py:1692-1706 | libs/agno/agno/os/middleware/jwt.py:1873-1885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/middleware/jwt.py:1692` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–15 lines × 2) libs/agno/agno/tools/file/file.py:395 — libs/agno/agno/tools/file/file.py:395-409 | libs/agno/agno/tools/workspace.py:840-852 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/tools/file/file.py:411` calls `_extract_snippet` and `libs/agno/agno/tools/workspace.py:854` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×5
  • Duplicated block (13–14 lines × 3) libs/agno/agno/db/mysql/mysql.py:1099 — libs/agno/agno/db/mysql/mysql.py:1099-1111 | libs/agno/agno/db/postgres/postgres.py:1920-1932 | libs/agno/agno/db/singlestore/singlestore.py:1154-1167 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1099` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 3) libs/agno/agno/tools/openweather.py:123 — libs/agno/agno/tools/openweather.py:123-135 | libs/agno/agno/tools/openweather.py:164-177 | libs/agno/agno/tools/openweather.py:210-222 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/openweather.py:164` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13–14 lines × 3) REDACTED:1531 — REDACTED:1531-1544 | REDACTED:1572-1584 | REDACTED:1607-1619 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 3) libs/agno/agno/vectordb/redis/redisdb.py:670 — libs/agno/agno/vectordb/redis/redisdb.py:670-683 | libs/agno/agno/vectordb/redis/redisdb.py:740-753 | libs/agno/agno/vectordb/valkey/valkeydb.py:790-802 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/vectordb/redis/redisdb.py:737` calls `convert_bytes` and `libs/agno/agno/vectordb/redis/redisdb.py:667` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–14 lines × 3) libs/agno_infra/agno/aws/resources.py:83 — libs/agno_infra/agno/aws/resources.py:83-95 | libs/agno_infra/agno/aws/resources.py:245-257 | libs/agno_infra/agno/aws/resources.py:401-414 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12 lines × 6) · ×5
  • Duplicated block (12 lines × 6) cookbook/91_tools/file_generation_tools.py:35 — cookbook/91_tools/file_generation_tools.py:35-46 | cookbook/91_tools/file_generation_tools.py:50-61 | cookbook/91_tools/file_generation_tools.py:65-76 | cookbook/91_tools/file_generation_tools.py:80-91 | cookbook/91_tools/file_generation_tools.py:95-106 | cookbook/91_tools/file_generation_tools.py:110-121 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 6) libs/agno/agno/db/mongo/async_mongo.py:1608 — libs/agno/agno/db/mongo/async_mongo.py:1608-1619 | libs/agno/agno/db/mongo/async_mongo.py:2179-2190 | libs/agno/agno/db/mongo/async_mongo.py:2422-2433 | libs/agno/agno/db/mongo/mongo.py:1414-1425 | libs/agno/agno/db/mongo/mongo.py:1984-1995 | libs/agno/agno/db/mongo/mongo.py:2228-2239 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 6) libs/agno/agno/os/interfaces/a2a/router.py:152 — libs/agno/agno/os/interfaces/a2a/router.py:152-163 | libs/agno/agno/os/interfaces/a2a/router.py:365-376 | libs/agno/agno/os/interfaces/a2a/router.py:483-494 | libs/agno/agno/os/interfaces/a2a/router.py:692-703 | libs/agno/agno/os/interfaces/a2a/router.py:810-821 | libs/agno/agno/os/interfaces/a2a/router.py:903-914 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/interfaces/a2a/router.py:166` calls `get` and `libs/agno/agno/os/interfaces/a2a/router.py:824` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 6) libs/agno_infra/agno/aws/resources.py:204 — libs/agno_infra/agno/aws/resources.py:204-215 | libs/agno_infra/agno/aws/resources.py:359-370 | libs/agno_infra/agno/aws/resources.py:507-518 | libs/agno_infra/agno/docker/resources.py:154-165 | libs/agno_infra/agno/docker/resources.py:320-331 | libs/agno_infra/agno/docker/resources.py:476-487 — `libs/agno_infra/agno/aws/resources.py` and `libs/agno_infra/agno/docker/resources.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 145 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno_infra/agno/docker/resources.py:332` calls `isinstance` and `libs/agno_infra/agno/aws/resources.py:372` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 6) libs/agno_infra/agno/aws/resources.py:223 — libs/agno_infra/agno/aws/resources.py:223-234 | libs/agno_infra/agno/aws/resources.py:378-389 | libs/agno_infra/agno/aws/resources.py:526-537 | libs/agno_infra/agno/docker/resources.py:178-189 | libs/agno_infra/agno/docker/resources.py:342-353 | libs/agno_infra/agno/docker/resources.py:500-511 — `libs/agno_infra/agno/aws/resources.py` and `libs/agno_infra/agno/docker/resources.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 145 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–11 lines × 4) · ×5
  • Duplicated block (10–11 lines × 4) libs/agno/agno/client/os.py:980 — libs/agno/agno/client/os.py:980-990 | libs/agno/agno/client/os.py:1034-1044 | libs/agno/agno/client/os.py:1272-1281 | libs/agno/agno/client/os.py:1322-1331 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/client/os.py:980` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/client/os.py:1270` calls `isinstance` and `libs/agno/agno/client/os.py:979` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 4) libs/agno/agno/db/dynamo/dynamo.py:1388 — libs/agno/agno/db/dynamo/dynamo.py:1388-1398 | libs/agno/agno/db/dynamo/dynamo.py:1459-1468 | libs/agno/agno/db/dynamo/dynamo.py:2009-2019 | libs/agno/agno/db/dynamo/dynamo.py:2398-2408 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/dynamo/dynamo.py:2022` calls `deserialize_from_dynamodb_item`, `drop_legacy_metrics` and `libs/agno/agno/db/dynamo/dynamo.py:2411` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 4) libs/agno/agno/db/gcs_json/gcs_json_db.py:856 — libs/agno/agno/db/gcs_json/gcs_json_db.py:856-865 | libs/agno/agno/db/json/json_db.py:920-929 | libs/agno/agno/db/redis/redis.py:1083-1093 | libs/agno/agno/db/valkey/valkey.py:1377-1387 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 4) libs/agno/agno/db/in_memory/in_memory_db.py:698 — libs/agno/agno/db/in_memory/in_memory_db.py:698-707 | libs/agno/agno/db/json/json_db.py:922-931 | libs/agno/agno/db/redis/redis.py:1085-1095 | libs/agno/agno/db/valkey/valkey.py:1379-1389 — `libs/agno/agno/db/in_memory/in_memory_db.py` and `libs/agno/agno/db/json/json_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 18 separate duplicated blocks between them, totalling at least 360 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 4) libs/agno/agno/db/mysql/mysql.py:202 — libs/agno/agno/db/mysql/mysql.py:202-212 | libs/agno/agno/db/postgres/async_postgres.py:377-386 | libs/agno/agno/db/singlestore/singlestore.py:269-279 | REDACTED:361-370 — before extracting anything, compare `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:377` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:387` calls `pop` and `libs/agno/agno/db/mysql/mysql.py:215` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 7) · ×5
  • Duplicated block (10 lines × 7) libs/agno/agno/db/gcs_json/gcs_json_db.py:634 — libs/agno/agno/db/gcs_json/gcs_json_db.py:634-643 | libs/agno/agno/db/json/json_db.py:683-692 | libs/agno/agno/db/mongo/async_mongo.py:1066-1076 | libs/agno/agno/db/mongo/mongo.py:878-887 | libs/agno/agno/db/mysql/async_mysql.py:1132-1142 | libs/agno/agno/db/mysql/mysql.py:1125-1135 | libs/agno/agno/db/singlestore/singlestore.py:1181-1191 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1066` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 7) libs/agno/agno/db/mongo/async_mongo.py:952 — libs/agno/agno/db/mongo/async_mongo.py:952-961 | libs/agno/agno/db/mongo/mongo.py:762-771 | libs/agno/agno/db/mysql/async_mysql.py:1011-1020 | libs/agno/agno/db/mysql/mysql.py:1004-1013 | libs/agno/agno/db/postgres/async_postgres.py:1591-1600 | libs/agno/agno/db/postgres/postgres.py:1822-1831 | libs/agno/agno/db/singlestore/singlestore.py:1059-1068 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:1114 — libs/agno/agno/db/mysql/async_mysql.py:1114-1123 | libs/agno/agno/db/mysql/async_mysql.py:1754-1763 | libs/agno/agno/db/mysql/async_mysql.py:2683-2692 | libs/agno/agno/db/postgres/async_postgres.py:1697-1706 | libs/agno/agno/db/postgres/async_postgres.py:2150-2159 | libs/agno/agno/db/postgres/async_postgres.py:3055-3064 | REDACTED:1626-1635 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:2681` calls `order_by`, `desc` and `libs/agno/agno/db/mysql/async_mysql.py:1111` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2876 — libs/agno/agno/db/mysql/async_mysql.py:2876-2885 | libs/agno/agno/db/mysql/mysql.py:2843-2852 | libs/agno/agno/db/postgres/async_postgres.py:3248-3257 | libs/agno/agno/db/postgres/postgres.py:3792-3801 | libs/agno/agno/db/singlestore/singlestore.py:2784-2793 | REDACTED:3402-3411 | REDACTED:3598-3607 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 7) libs/agno/agno/db/mysql/mysql.py:1814 — libs/agno/agno/db/mysql/mysql.py:1814-1823 | libs/agno/agno/db/mysql/mysql.py:2351-2360 | libs/agno/agno/db/postgres/postgres.py:2691-2700 | libs/agno/agno/db/postgres/postgres.py:3257-3266 | libs/agno/agno/db/singlestore/singlestore.py:1838-1847 | libs/agno/agno/db/singlestore/singlestore.py:2375-2384 | REDACTED:3181-3190 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×5
  • Duplicated block (7 lines × 6) libs/agno/agno/db/base.py:495 — libs/agno/agno/db/base.py:495-501 | libs/agno/agno/db/base.py:2769-2775 | libs/agno/agno/db/postgres/async_postgres.py:280-286 | libs/agno/agno/db/postgres/postgres.py:318-324 | REDACTED:266-272 | REDACTED:316-322 — before extracting anything, compare `libs/agno/agno/db/base.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 6) libs/agno/agno/db/mongo/async_mongo.py:1249 — libs/agno/agno/db/mongo/async_mongo.py:1249-1257 | libs/agno/agno/db/mongo/mongo.py:1058-1066 | libs/agno/agno/db/mysql/mysql.py:1299-1305 | libs/agno/agno/db/redis/redis.py:957-965 | libs/agno/agno/db/singlestore/singlestore.py:1357-1364 | libs/agno/agno/db/valkey/valkey.py:1091-1099 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mysql/mysql.py:1297` calls `dict` and `libs/agno/agno/db/mongo/async_mongo.py:1247` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 6) REDACTED:1901 — REDACTED:1901-1907 | REDACTED:1961-1967 | REDACTED:2021-2027 | REDACTED:2158-2164 | REDACTED:2218-2224 | REDACTED:2278-2284 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1901` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 6) libs/agno/agno/tools/studio_runner.py:2705 — libs/agno/agno/tools/studio_runner.py:2705-2711 | libs/agno/agno/tools/studio_runner.py:2771-2777 | libs/agno/agno/tools/studio_runner.py:2837-2843 | libs/agno/agno/tools/studio_runner.py:2903-2909 | libs/agno/agno/tools/studio_runner.py:2971-2977 | libs/agno/agno/tools/studio_runner.py:3037-3043 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 6) libs/agno/agno/tools/studio_runner.py:2715 — libs/agno/agno/tools/studio_runner.py:2715-2721 | libs/agno/agno/tools/studio_runner.py:2781-2787 | libs/agno/agno/tools/studio_runner.py:2847-2853 | libs/agno/agno/tools/studio_runner.py:2916-2922 | libs/agno/agno/tools/studio_runner.py:2982-2988 | libs/agno/agno/tools/studio_runner.py:3050-3056 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×5
  • Duplicated block (6 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:3156 — libs/agno/agno/db/mysql/async_mysql.py:3156-3161 | libs/agno/agno/db/mysql/mysql.py:3120-3125 | libs/agno/agno/db/postgres/async_postgres.py:3560-3565 | libs/agno/agno/db/postgres/postgres.py:4102-4107 | libs/agno/agno/db/singlestore/singlestore.py:3066-3071 | REDACTED:3710-3715 | REDACTED:3909-3914 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:3156` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:3164 — libs/agno/agno/db/mysql/async_mysql.py:3164-3169 | libs/agno/agno/db/mysql/mysql.py:3128-3133 | libs/agno/agno/db/postgres/async_postgres.py:3568-3573 | libs/agno/agno/db/postgres/postgres.py:4110-4115 | libs/agno/agno/db/singlestore/singlestore.py:3074-3079 | REDACTED:3718-3723 | REDACTED:3917-3922 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:3164` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 7) REDACTED:981 — REDACTED:981-986 | REDACTED:987-992 | REDACTED:993-998 | REDACTED:999-1004 | REDACTED:1005-1010 | REDACTED:1011-1016 | REDACTED:1017-1023 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 7) libs/agno/agno/knowledge/embedder/aws_bedrock.py:351 — libs/agno/agno/knowledge/embedder/aws_bedrock.py:351-356 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:419-424 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:464-469 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:486-491 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:510-515 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:538-543 | libs/agno/agno/knowledge/embedder/aws_bedrock.py:570-575 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 7) libs/agno/agno/learn/machine.py:1028 — libs/agno/agno/learn/machine.py:1028-1033 | libs/agno/agno/learn/stores/decision_log.py:283-288 | libs/agno/agno/learn/stores/entity_memory.py:903-908 | libs/agno/agno/learn/stores/learned_knowledge.py:486-491 | libs/agno/agno/learn/stores/session_context.py:268-273 | libs/agno/agno/learn/stores/user_memory.py:328-333 | libs/agno/agno/learn/stores/user_profile.py:342-347 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times.
D4 · Code Duplication · Duplicated block (5 lines × 8) · ×5
  • Duplicated block (5 lines × 8) libs/agno/agno/agent/_tools.py:1079 — libs/agno/agno/agent/_tools.py:1079-1084 | libs/agno/agno/agent/_tools.py:1131-1136 | libs/agno/agno/agent/_tools.py:1181-1186 | libs/agno/agno/agent/_tools.py:1241-1246 | libs/agno/agno/team/_run.py:5405-5410 | libs/agno/agno/team/_run.py:5465-5470 | libs/agno/agno/team/_run.py:5539-5543 | libs/agno/agno/team/_run.py:5619-5624 — there are 8 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 8) libs/agno/agno/db/postgres/async_postgres.py:6508 — libs/agno/agno/db/postgres/async_postgres.py:6508-6512 | libs/agno/agno/db/postgres/async_postgres.py:7014-7018 | libs/agno/agno/db/postgres/postgres.py:9257-9261 | libs/agno/agno/db/postgres/postgres.py:9745-9749 | REDACTED:5677-5681 | REDACTED:6183-6187 | REDACTED:8186-8190 | REDACTED:8674-8678 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 8) libs/agno/agno/db/postgres/async_postgres.py:6520 — libs/agno/agno/db/postgres/async_postgres.py:6520-6524 | libs/agno/agno/db/postgres/async_postgres.py:7036-7040 | libs/agno/agno/db/postgres/postgres.py:9269-9273 | libs/agno/agno/db/postgres/postgres.py:9767-9771 | REDACTED:5689-5693 | REDACTED:6205-6209 | REDACTED:8198-8202 | REDACTED:8696-8700 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 8) libs/agno/agno/db/postgres/postgres.py:9220 — libs/agno/agno/db/postgres/postgres.py:9220-9224 | libs/agno/agno/db/postgres/postgres.py:9324-9328 | libs/agno/agno/db/postgres/postgres.py:9448-9452 | libs/agno/agno/db/postgres/postgres.py:9705-9709 | REDACTED:8149-8153 | REDACTED:8253-8257 | REDACTED:8377-8381 | REDACTED:8634-8638 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 8) libs/agno/agno/tools/google/gmail.py:1462 — libs/agno/agno/tools/google/gmail.py:1462-1466 | libs/agno/agno/tools/google/gmail.py:1489-1494 | libs/agno/agno/tools/google/gmail.py:1565-1569 | libs/agno/agno/tools/google/gmail.py:1586-1590 | libs/agno/agno/tools/google/gmail.py:1612-1617 | libs/agno/agno/tools/google/gmail.py:1674-1679 | libs/agno/agno/tools/google/gmail.py:1819-1823 | libs/agno/agno/tools/google/gmail.py:1873-1877 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/google/gmail.py:1489` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×5
  • Sync-over-async blocking cookbook/02_agents/18_checkpointing/01_crash_recovery.py:82 — `main` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking cookbook/03_teams/23_checkpointing/01_crash_recovery.py:81 — `main` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:237 — `run_async` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking cookbook/07_knowledge/09_archive/vector_dbs/lightrag.py:49 — `main` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
  • Sync-over-async blocking cookbook/91_tools/zep_tools.py:66 — `run_async` is async and calls time.sleep — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
X1 · Async correctness · Blocking `time.sleep` inside an `async def` · ×5
  • Blocking `time.sleep` inside an `async def` cookbook/91_tools/zep_tools.py:88 — This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
  • Blocking `time.sleep` inside an `async def` cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:244 — This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
  • Blocking `time.sleep` inside an `async def` cookbook/07_knowledge/09_archive/vector_dbs/lightrag.py:65 — This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
  • Blocking `time.sleep` inside an `async def` cookbook/03_teams/23_checkpointing/01_crash_recovery.py:103 — This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
  • Blocking `time.sleep` inside an `async def` cookbook/02_agents/18_checkpointing/01_crash_recovery.py:105 — This `async def` runs on the event loop's thread, and `time.sleep` blocks that thread: for the whole delay no other coroutine, request or callback on the loop makes progress — the Python form of blocking on a task. Use `await asyncio.sleep(…)`, which suspends only this coroutine. Where the blocking work is not a sleep but a synchronous call that cannot be made async, move it off the loop with `await asyncio.to_thread(…)` (or `loop.run_in_executor(…)`).
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×4
  • Animation without a prefers-reduced-motion guard cookbook/data_labeling/image_search/public/index.html:14 — `.skel` moves (`animation: sk 1.4s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cookbook/data_labeling/image_search/public/index.html:17 — `.card` moves (`transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cookbook/data_labeling/image_search/public/index.html:19 — `.card img` moves (`transition: transform .3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cookbook/data_labeling/image_search/public/index.html:75 — <i> moves — its `animate-spin` utility runs with no motion-safe:/motion-reduce: variant — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
D4 · Code Duplication · Duplicated block (62 lines × 2) · ×4
  • Duplicated block (62 lines × 2) libs/agno/agno/agent/_response.py:1084 — libs/agno/agno/agent/_response.py:1084-1145 | libs/agno/agno/agent/_response.py:1250-1311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (62 lines × 2) libs/agno/agno/team/_response.py:1036 — libs/agno/agno/team/_response.py:1036-1097 | libs/agno/agno/team/_response.py:1198-1259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (62 lines × 2) libs/agno/agno/team/_run.py:2356 — libs/agno/agno/team/_run.py:2356-2417 | libs/agno/agno/team/_run.py:3294-3355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (62 lines × 2) libs/agno/agno/workflow/loop.py:471 — libs/agno/agno/workflow/loop.py:471-532 | libs/agno/agno/workflow/loop.py:869-930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:471` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (56 lines × 2) · ×4
  • Duplicated block (56 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1383 — libs/agno/agno/db/postgres/async_postgres.py:1383-1438 | REDACTED:1308-1363 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:1383` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (56 lines × 2) libs/agno/agno/os/routers/agents/router.py:1659 — libs/agno/agno/os/routers/agents/router.py:1659-1714 | libs/agno/agno/os/routers/teams/router.py:1614-1669 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1659` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (56 lines × 2) libs/agno/agno/workflow/router.py:671 — libs/agno/agno/workflow/router.py:671-726 | libs/agno/agno/workflow/router.py:1005-1060 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/router.py:671` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/router.py:1062` calls `getattr`, `log_debug` and `libs/agno/agno/workflow/router.py:728` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (56 lines × 2) libs/agno/agno/workflow/step.py:3081 — libs/agno/agno/workflow/step.py:3081-3136 | libs/agno/agno/workflow/step.py:3359-3414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (54 lines × 2) · ×4
  • Duplicated block (54 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1184 — libs/agno/agno/db/mongo/async_mongo.py:1184-1237 | libs/agno/agno/db/mongo/mongo.py:992-1045 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (54 lines × 2) libs/agno/agno/eval/reliability.py:277 — libs/agno/agno/eval/reliability.py:277-330 | libs/agno/agno/eval/reliability.py:352-405 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (54 lines × 2) libs/agno/agno/fs/toolkit.py:335 — libs/agno/agno/fs/toolkit.py:335-388 | libs/agno/agno/fs/toolkit.py:748-801 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (54 lines × 2) libs/agno/agno/workflow/steps.py:287 — libs/agno/agno/workflow/steps.py:287-340 | libs/agno/agno/workflow/steps.py:593-646 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/steps.py:287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/steps.py:341` calls `log_debug` and `libs/agno/agno/workflow/steps.py:649` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (50 lines × 2) · ×4
  • Duplicated block (50 lines × 2) cookbook/02_agents/18_checkpointing/01_crash_recovery.py:103 — cookbook/02_agents/18_checkpointing/01_crash_recovery.py:103-152 | cookbook/03_teams/23_checkpointing/01_crash_recovery.py:101-150 — before extracting anything, compare `cookbook/02_agents/18_checkpointing/01_crash_recovery.py` and `cookbook/03_teams/23_checkpointing/01_crash_recovery.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (50 lines × 2) libs/agno/agno/db/postgres/postgres.py:412 — libs/agno/agno/db/postgres/postgres.py:412-461 | REDACTED:419-468 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (50 lines × 2) libs/agno/agno/team/_messages.py:632 — libs/agno/agno/team/_messages.py:632-681 | libs/agno/agno/team/_messages.py:888-937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (50 lines × 2) libs/agno/agno/workflow/step.py:2930 — libs/agno/agno/workflow/step.py:2930-2979 | libs/agno/agno/workflow/step.py:3207-3256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:2930` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (36–37 lines × 2) · ×4
  • Duplicated block (36–37 lines × 2) libs/agno/agno/db/migrations/manager.py:49 — libs/agno/agno/db/migrations/manager.py:49-85 | libs/agno/agno/db/migrations/manager.py:164-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `target_version` to `Optional[str] = None` in one and `str` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (36–37 lines × 2) libs/agno/agno/db/mysql/mysql.py:412 — libs/agno/agno/db/mysql/mysql.py:412-448 | libs/agno/agno/db/postgres/postgres.py:865-900 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (36–37 lines × 2) libs/agno/agno/db/singlestore/singlestore.py:699 — libs/agno/agno/db/singlestore/singlestore.py:699-735 | REDACTED:1123-1158 — `libs/agno/agno/db/singlestore/singlestore.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 97 separate duplicated blocks between them, totalling at least 1641 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (36–37 lines × 2) libs/agno/agno/run/approval.py:232 — libs/agno/agno/run/approval.py:232-268 | libs/agno/agno/run/approval.py:295-330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–32 lines × 3) · ×4
  • Duplicated block (31–32 lines × 3) libs/agno/agno/db/mysql/mysql.py:2313 — libs/agno/agno/db/mysql/mysql.py:2313-2343 | libs/agno/agno/db/singlestore/singlestore.py:2336-2367 | REDACTED:3143-3173 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31–32 lines × 3) libs/agno/agno/team/_run.py:797 — libs/agno/agno/team/_run.py:797-827 | libs/agno/agno/team/_run.py:1663-1694 | libs/agno/agno/team/_run.py:8449-8479 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (31–32 lines × 3) libs/agno/agno/team/_run.py:2730 — libs/agno/agno/team/_run.py:2730-2760 | libs/agno/agno/team/_run.py:3861-3892 | libs/agno/agno/team/_run.py:10168-10198 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (31–32 lines × 3) libs/agno_infra/agno/cli/operator.py:81 — libs/agno_infra/agno/cli/operator.py:81-112 | libs/agno_infra/agno/cli/operator.py:155-186 | libs/agno_infra/agno/cli/operator.py:228-258 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28 lines × 3) · ×4
  • Duplicated block (28 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:588 — libs/agno/agno/db/gcs_json/gcs_json_db.py:588-615 | libs/agno/agno/db/in_memory/in_memory_db.py:265-292 | libs/agno/agno/db/json/json_db.py:637-664 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 3) libs/agno/agno/db/gcs_json/gcs_json_db.py:1113 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1113-1140 | libs/agno/agno/db/in_memory/in_memory_db.py:952-979 | libs/agno/agno/db/json/json_db.py:1180-1207 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/gcs_json/gcs_json_db.py:1113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (28 lines × 3) libs/agno/agno/team/_run.py:2224 — libs/agno/agno/team/_run.py:2224-2251 | libs/agno/agno/team/_run.py:2607-2634 | libs/agno/agno/team/_run.py:3776-3803 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (28 lines × 3) libs/agno_infra/agno/cli/infra_cli.py:226 — libs/agno_infra/agno/cli/infra_cli.py:226-253 | libs/agno_infra/agno/cli/infra_cli.py:415-442 | libs/agno_infra/agno/cli/infra_cli.py:582-609 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27 lines × 4) · ×4
  • Duplicated block (27 lines × 4) libs/agno/agno/db/mysql/mysql.py:981 — libs/agno/agno/db/mysql/mysql.py:981-1007 | libs/agno/agno/db/postgres/postgres.py:1799-1825 | libs/agno/agno/db/singlestore/singlestore.py:1036-1062 | REDACTED:1755-1781 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (27 lines × 4) libs/agno/agno/db/mysql/mysql.py:2536 — libs/agno/agno/db/mysql/mysql.py:2536-2562 | libs/agno/agno/db/postgres/postgres.py:3483-3509 | libs/agno/agno/db/singlestore/singlestore.py:2532-2558 | REDACTED:3343-3369 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 4) libs/agno/agno/reasoning/anthropic.py:78 — libs/agno/agno/reasoning/anthropic.py:78-104 | libs/agno/agno/reasoning/anthropic.py:157-183 | libs/agno/agno/reasoning/vertexai.py:32-58 | libs/agno/agno/reasoning/vertexai.py:69-95 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/vertexai.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 128 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (27 lines × 4) libs/agno/agno/workflow/workflow.py:7107 — libs/agno/agno/workflow/workflow.py:7107-7133 | libs/agno/agno/workflow/workflow.py:7981-8007 | libs/agno/agno/workflow/workflow.py:9165-9191 | libs/agno/agno/workflow/workflow.py:9740-9766 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:9193` calls `araise_if_cancelled` and `libs/agno/agno/workflow/workflow.py:7136` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25–27 lines × 2) · ×4
  • Duplicated block (25–27 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1223 — libs/agno/agno/db/mysql/async_mysql.py:1223-1247 | REDACTED:1714-1740 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1223` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–27 lines × 2) libs/agno/agno/tools/opencv.py:48 — libs/agno/agno/tools/opencv.py:48-72 | libs/agno/agno/tools/opencv.py:153-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–27 lines × 2) libs/agno/agno/workflow/workflow.py:3128 — libs/agno/agno/workflow/workflow.py:3128-3154 | libs/agno/agno/workflow/workflow.py:7426-7450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–27 lines × 2) libs/agno/agno/workflow/workflow.py:4133 — libs/agno/agno/workflow/workflow.py:4133-4159 | libs/agno/agno/workflow/workflow.py:9472-9496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×4
  • Duplicated block (24 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2567 — libs/agno/agno/db/mysql/async_mysql.py:2567-2590 | libs/agno/agno/db/postgres/async_postgres.py:2939-2962 | REDACTED:3090-3113 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 3) libs/agno/agno/db/mysql/mysql.py:3233 — libs/agno/agno/db/mysql/mysql.py:3233-3256 | libs/agno/agno/db/postgres/postgres.py:4298-4321 | libs/agno/agno/db/singlestore/singlestore.py:3185-3208 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 3) libs/agno/agno/os/routers/agents/router.py:622 — libs/agno/agno/os/routers/agents/router.py:622-645 | libs/agno/agno/os/routers/teams/router.py:386-409 | libs/agno/agno/os/routers/workflows/router.py:1565-1588 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 3) libs/agno/agno/workflow/condition.py:607 — libs/agno/agno/workflow/condition.py:607-630 | libs/agno/agno/workflow/condition.py:1060-1083 | libs/agno/agno/workflow/router.py:1054-1077 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–24 lines × 2) · ×4
  • Duplicated block (22–24 lines × 2) libs/agno/agno/knowledge/utils.py:181 — libs/agno/agno/knowledge/utils.py:181-202 | libs/agno/agno/knowledge/utils.py:211-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/knowledge/utils.py:180` calls `ValueError` and `libs/agno/agno/knowledge/utils.py:210` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22–24 lines × 2) libs/agno/agno/team/_task_tools.py:637 — libs/agno/agno/team/_task_tools.py:637-658 | libs/agno/agno/team/_task_tools.py:827-850 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_task_tools.py:827` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22–24 lines × 2) libs/agno/agno/tools/e2b.py:163 — libs/agno/agno/tools/e2b.py:163-184 | libs/agno/agno/tools/e2b.py:224-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `agent` to `Union[Agent, Team]` in one and `Agent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (22–24 lines × 2) libs/agno/agno/workflow/parallel.py:432 — libs/agno/agno/workflow/parallel.py:432-455 | libs/agno/agno/workflow/parallel.py:800-821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/parallel.py:432` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–22 lines × 2) · ×4
  • Duplicated block (19–22 lines × 2) libs/agno/agno/agent/_storage.py:1045 — libs/agno/agno/agent/_storage.py:1045-1063 | libs/agno/agno/team/_storage.py:821-842 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19–22 lines × 2) libs/agno/agno/db/postgres/postgres.py:1402 — libs/agno/agno/db/postgres/postgres.py:1402-1423 | REDACTED:1388-1406 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:1424` calls `_collect_sandbox_leftovers` and `REDACTED:1407` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19–22 lines × 2) libs/agno/agno/os/routers/registry/registry.py:177 — libs/agno/agno/os/routers/registry/registry.py:177-195 | libs/agno/agno/os/routers/registry/registry.py:237-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19–22 lines × 2) libs/agno/agno/team/_run.py:1061 — libs/agno/agno/team/_run.py:1061-1079 | libs/agno/agno/team/_run.py:1877-1898 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–19 lines × 2) · ×4
  • Duplicated block (15–19 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1289 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1289-1303 | libs/agno/agno/db/json/json_db.py:1357-1375 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15–19 lines × 2) REDACTED:1234 — REDACTED:1234-1252 | REDACTED:1304-1318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1234` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–19 lines × 2) REDACTED:4290 — REDACTED:4290-4308 | REDACTED:4353-4367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `BaseDb` in one and `AsyncBaseDb` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (15–19 lines × 2) libs/agno/agno/os/interfaces/slack/router.py:138 — libs/agno/agno/os/interfaces/slack/router.py:138-156 | libs/agno/agno/os/interfaces/slack/router.py:202-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/slack/router.py:138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×4
  • Duplicated block (17–18 lines × 3) REDACTED:585 — REDACTED:585-602 | REDACTED:716-732 | REDACTED:846-862 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:716` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (17–18 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2399 — libs/agno/agno/db/mysql/async_mysql.py:2399-2415 | libs/agno/agno/db/postgres/async_postgres.py:2744-2760 | REDACTED:2944-2961 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2399` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2539 — libs/agno/agno/db/mysql/async_mysql.py:2539-2556 | libs/agno/agno/db/postgres/async_postgres.py:2911-2928 | REDACTED:3062-3078 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 3) libs/agno/agno/team/_run.py:3023 — libs/agno/agno/team/_run.py:3023-3039 | libs/agno/agno/team/_run.py:3427-3444 | libs/agno/agno/team/_run.py:4108-4125 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:3023` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–17 lines × 3) · ×4
  • Duplicated block (16–17 lines × 3) libs/agno/agno/db/mongo/async_mongo.py:1826 — libs/agno/agno/db/mongo/async_mongo.py:1826-1842 | libs/agno/agno/db/mysql/async_mysql.py:2022-2037 | REDACTED:2528-2544 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 3) libs/agno/agno/db/mongo/mongo.py:1631 — libs/agno/agno/db/mongo/mongo.py:1631-1647 | libs/agno/agno/db/mysql/mysql.py:1993-2008 | REDACTED:2783-2799 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 3) libs/agno/agno/team/_run.py:1816 — libs/agno/agno/team/_run.py:1816-1832 | libs/agno/agno/team/_run.py:4020-4035 | libs/agno/agno/team/_run.py:8572-8587 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1816` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 3) REDACTED:364 — REDACTED:364-380 | REDACTED:1126-1141 | REDACTED:1240-1255 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1259` calls `info` and `REDACTED:1145` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–17 lines × 3) · ×4
  • Duplicated block (15–17 lines × 3) libs/agno/agno/models/openrouter/responses.py:65 — libs/agno/agno/models/openrouter/responses.py:65-80 | libs/agno/agno/models/ramp/router.py:158-174 | libs/agno/agno/models/xai/responses.py:124-138 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–17 lines × 3) libs/agno/agno/tools/studio_runner.py:2909 — libs/agno/agno/tools/studio_runner.py:2909-2925 | libs/agno/agno/tools/studio_runner.py:2977-2991 | libs/agno/agno/tools/studio_runner.py:3043-3059 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio_runner.py:2909` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–17 lines × 3) libs/agno/agno/workflow/workflow.py:3475 — libs/agno/agno/workflow/workflow.py:3475-3491 | libs/agno/agno/workflow/workflow.py:7920-7934 | libs/agno/agno/workflow/workflow.py:8320-8336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15–17 lines × 3) libs/agno/agno/workflow/workflow.py:4516 — libs/agno/agno/workflow/workflow.py:4516-4532 | libs/agno/agno/workflow/workflow.py:9679-9693 | libs/agno/agno/workflow/workflow.py:10080-10096 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×4
  • Duplicated block (15–17 lines × 2) libs/agno/agno/db/firestore/firestore.py:2406 — libs/agno/agno/db/firestore/firestore.py:2406-2422 | libs/agno/agno/db/firestore/firestore.py:2497-2511 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15–17 lines × 2) REDACTED:2055 — REDACTED:2055-2071 | REDACTED:2124-2138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–17 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:745 — libs/agno/agno/db/postgres/async_postgres.py:745-761 | REDACTED:703-717 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–17 lines × 2) libs/agno/agno/workflow/workflow.py:5841 — libs/agno/agno/workflow/workflow.py:5841-5857 | libs/agno/agno/workflow/workflow.py:6248-6262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5841` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:6263` calls `log_debug` and `libs/agno/agno/workflow/workflow.py:5858` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–14 lines × 4) · ×4
  • Duplicated block (13–14 lines × 4) libs/agno/agno/agent/_messages.py:1567 — libs/agno/agno/agent/_messages.py:1567-1580 | libs/agno/agno/agent/_messages.py:1737-1750 | libs/agno/agno/team/_messages.py:1236-1248 | libs/agno/agno/team/_messages.py:1395-1407 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1567` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 4) libs/agno/agno/agent/_run.py:1858 — libs/agno/agno/agent/_run.py:1858-1870 | libs/agno/agno/agent/_run.py:2592-2605 | libs/agno/agno/agent/_run.py:5088-5100 | libs/agno/agno/agent/_run.py:5707-5720 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5083` calls `cast` and `libs/agno/agno/agent/_run.py:1853` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–14 lines × 4) libs/agno/agno/os/routers/agents/router.py:171 — libs/agno/agno/os/routers/agents/router.py:171-183 | libs/agno/agno/os/routers/agents/router.py:267-279 | libs/agno/agno/os/routers/agents/router.py:389-402 | libs/agno/agno/os/routers/agents/router.py:472-484 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 4) libs/agno/agno/workflow/workflow.py:7035 — libs/agno/agno/workflow/workflow.py:7035-7048 | libs/agno/agno/workflow/workflow.py:7884-7896 | libs/agno/agno/workflow/workflow.py:9098-9111 | libs/agno/agno/workflow/workflow.py:9644-9656 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:7884` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 6) · ×4
  • Duplicated block (13 lines × 6) libs/agno/agno/learn/stores/session_context.py:292 — libs/agno/agno/learn/stores/session_context.py:292-304 | libs/agno/agno/learn/stores/session_context.py:318-330 | libs/agno/agno/learn/stores/user_memory.py:450-462 | libs/agno/agno/learn/stores/user_memory.py:476-488 | libs/agno/agno/learn/stores/user_profile.py:618-630 | libs/agno/agno/learn/stores/user_profile.py:644-656 — there are 6 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 6) libs/agno/agno/tools/scheduler.py:766 — libs/agno/agno/tools/scheduler.py:766-783 | libs/agno/agno/tools/scheduler.py:879-891 | libs/agno/agno/tools/scheduler.py:908-920 | libs/agno/agno/tools/scheduler.py:1155-1172 | libs/agno/agno/tools/scheduler.py:1270-1282 | libs/agno/agno/tools/scheduler.py:1301-1313 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 6) libs/agno_infra/agno/aws/resource/ecs/cluster.py:75 — libs/agno_infra/agno/aws/resource/ecs/cluster.py:75-87 | libs/agno_infra/agno/aws/resource/ecs/service.py:212-224 | libs/agno_infra/agno/aws/resource/ecs/task_definition.py:169-181 | libs/agno_infra/agno/aws/resource/elb/listener.py:87-99 | libs/agno_infra/agno/aws/resource/elb/load_balancer.py:82-94 | libs/agno_infra/agno/aws/resource/elb/target_group.py:101-113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resource/ecs/cluster.py:75` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 6) cookbook/07_knowledge/09_archive/embedders/azure_embedder.py:20 — cookbook/07_knowledge/09_archive/embedders/azure_embedder.py:20-32 | cookbook/07_knowledge/09_archive/embedders/fireworks_embedder.py:20-32 | cookbook/07_knowledge/09_archive/embedders/gemini_embedder.py:20-32 | cookbook/07_knowledge/09_archive/embedders/mistral_embedder.py:20-32 | cookbook/07_knowledge/09_archive/embedders/openai_embedder.py:20-32 | cookbook/07_knowledge/09_archive/embedders/voyageai_embedder.py:20-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×4
  • Duplicated block (11 lines × 5) libs/agno/agno/agent/_run.py:1282 — libs/agno/agno/agent/_run.py:1282-1292 | libs/agno/agno/agent/_run.py:2662-2672 | libs/agno/agno/agent/_run.py:4163-4173 | libs/agno/agno/agent/_run.py:5154-5164 | libs/agno/agno/agent/_run.py:5789-5799 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:5152` calls `RunOutput` and `libs/agno/agno/agent/_run.py:2659` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 5) libs/agno/agno/agent/_storage.py:1365 — libs/agno/agno/agent/_storage.py:1365-1375 | libs/agno/agno/agent/_storage.py:1379-1389 | libs/agno/agno/team/_storage.py:1243-1253 | libs/agno/agno/team/_storage.py:1257-1267 | libs/agno/agno/workflow/workflow.py:1334-1344 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:1353 — libs/agno/agno/db/mysql/async_mysql.py:1353-1366 | libs/agno/agno/db/mysql/mysql.py:1338-1350 | libs/agno/agno/db/singlestore/singlestore.py:1392-1402 | REDACTED:1839-1852 | REDACTED:2096-2109 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:2019 — libs/agno/agno/db/mysql/async_mysql.py:2019-2031 | libs/agno/agno/db/mysql/mysql.py:1990-2002 | libs/agno/agno/db/singlestore/singlestore.py:2008-2018 | REDACTED:2525-2538 | REDACTED:2780-2793 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2019` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×4
  • Duplicated block (8 lines × 6) libs/agno/agno/agent/_session.py:385 — libs/agno/agno/agent/_session.py:385-392 | libs/agno/agno/agent/_session.py:421-428 | libs/agno/agno/team/_session.py:812-819 | libs/agno/agno/team/_session.py:848-855 | libs/agno/agno/workflow/workflow.py:1147-1154 | libs/agno/agno/workflow/workflow.py:1194-1201 — there are 6 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_session.py:430` calls `has_async_db`, `delete_session` and `libs/agno/agno/agent/_session.py:394` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 6) libs/agno/agno/agent/remote.py:392 — libs/agno/agno/agent/remote.py:392-399 | libs/agno/agno/agent/remote.py:435-442 | libs/agno/agno/team/remote.py:384-391 | libs/agno/agno/team/remote.py:427-434 | libs/agno/agno/workflow/remote.py:297-304 | libs/agno/agno/workflow/remote.py:337-344 — `libs/agno/agno/agent/remote.py` and `libs/agno/agno/team/remote.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 134 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 6) libs/agno/agno/db/gcs_json/gcs_json_db.py:919 — libs/agno/agno/db/gcs_json/gcs_json_db.py:919-926 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1500-1507 | libs/agno/agno/db/json/json_db.py:986-993 | libs/agno/agno/db/json/json_db.py:1600-1607 | libs/agno/agno/db/redis/redis.py:1857-1865 | libs/agno/agno/db/valkey/valkey.py:2287-2296 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 6) cookbook/07_knowledge/09_archive/embedders/cohere_embedder.py:44 — cookbook/07_knowledge/09_archive/embedders/cohere_embedder.py:44-51 | cookbook/07_knowledge/09_archive/embedders/fireworks_embedder.py:39-46 | cookbook/07_knowledge/09_archive/embedders/gemini_embedder.py:39-46 | cookbook/07_knowledge/09_archive/embedders/mistral_embedder.py:39-46 | cookbook/07_knowledge/09_archive/embedders/openai_embedder.py:39-46 | cookbook/07_knowledge/09_archive/embedders/voyageai_embedder.py:39-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7 lines × 7) · ×4
  • Duplicated block (7 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:579 — libs/agno/agno/db/mysql/async_mysql.py:579-585 | libs/agno/agno/db/mysql/mysql.py:575-581 | libs/agno/agno/db/postgres/async_postgres.py:876-882 | libs/agno/agno/db/postgres/postgres.py:1032-1038 | libs/agno/agno/db/singlestore/singlestore.py:654-660 | REDACTED:831-837 | REDACTED:999-1005 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:579` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:606 — libs/agno/agno/db/mysql/async_mysql.py:606-612 | libs/agno/agno/db/mysql/mysql.py:600-606 | libs/agno/agno/db/postgres/async_postgres.py:903-909 | libs/agno/agno/db/postgres/postgres.py:1057-1063 | libs/agno/agno/db/singlestore/singlestore.py:678-684 | REDACTED:858-864 | REDACTED:1046-1052 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2250 — libs/agno/agno/db/mysql/async_mysql.py:2250-2256 | libs/agno/agno/db/mysql/mysql.py:2217-2223 | libs/agno/agno/db/postgres/async_postgres.py:2596-2602 | libs/agno/agno/db/postgres/postgres.py:3126-3132 | libs/agno/agno/db/singlestore/singlestore.py:2244-2250 | REDACTED:2791-2797 | REDACTED:3043-3049 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 7) REDACTED:184 — REDACTED:184-190 | REDACTED:299-308 | REDACTED:337-344 | REDACTED:670-679 | REDACTED:360-368 | REDACTED:196-204 | REDACTED:1136-1144 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D1 · Cyclomatic Complexity · router._resume_stream_generator (cyclomatic 19) · ×3
  • router._resume_stream_generator (cyclomatic 19) libs/agno/agno/os/routers/agents/router.py:495 — router._resume_stream_generator has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • router._resume_stream_generator (cyclomatic 19) libs/agno/agno/os/routers/teams/router.py:259 — router._resume_stream_generator has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • router._resume_stream_generator (cyclomatic 19) libs/agno/agno/os/routers/workflows/router.py:1438 — router._resume_stream_generator has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · router._resume_stream_generator (cognitive 30) · ×3
  • router._resume_stream_generator (cognitive 30) libs/agno/agno/os/routers/agents/router.py:495 — router._resume_stream_generator has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (9 pts), error handling 3 (6 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • router._resume_stream_generator (cognitive 30) libs/agno/agno/os/routers/teams/router.py:259 — router._resume_stream_generator has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (9 pts), error handling 3 (6 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • router._resume_stream_generator (cognitive 30) libs/agno/agno/os/routers/workflows/router.py:1438 — router._resume_stream_generator has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (9 pts), error handling 3 (6 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D31 · IaC & Container Security · Medium IaC · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (127 shared lines) · ×3
  • Near-duplicate member pair (127 shared lines) libs/agno/agno/agent/_run.py:382 — libs/agno/agno/agent/_run.py:382-774 | libs/agno/agno/agent/_run.py:794-1318 — These two members are variants of one another: 127 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (127 shared lines) libs/agno/agno/team/_run.py:1096 — libs/agno/agno/team/_run.py:1096-1439 | libs/agno/agno/team/_run.py:1458-1898 — These two members are variants of one another: 127 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (127 shared lines) libs/agno/agno/agent/_storage.py:1229 — libs/agno/agno/agent/_storage.py:1229-1569 | libs/agno/agno/team/_storage.py:963-1445 — These two members are variants of one another: 127 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (71 shared lines) · ×3
  • Near-duplicate member pair (71 shared lines) cookbook/02_agents/18_checkpointing/01_crash_recovery.py:86 — cookbook/02_agents/18_checkpointing/01_crash_recovery.py:86-165 | cookbook/03_teams/23_checkpointing/01_crash_recovery.py:85-161 — These two members are variants of one another: 71 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (71 shared lines) libs/agno/agno/agent/_run_options.py:94 — libs/agno/agno/agent/_run_options.py:94-186 | libs/agno/agno/team/_run_options.py:92-182 — These two members are variants of one another: 71 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (71 shared lines) libs/agno/agno/os/middleware/jwt.py:1088 — libs/agno/agno/os/middleware/jwt.py:1088-1197 | libs/agno/agno/os/middleware/jwt.py:1288-1381 — These two members are variants of one another: 71 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Duplicated block (54–59 lines × 2) · ×3
  • Duplicated block (54–59 lines × 2) libs/agno/agno/db/redis/redis.py:726 — libs/agno/agno/db/redis/redis.py:726-779 | libs/agno/agno/db/valkey/valkey.py:852-910 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (54–59 lines × 2) libs/agno/agno/team/_run.py:461 — libs/agno/agno/team/_run.py:461-514 | libs/agno/agno/team/_run.py:1301-1359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (54–59 lines × 2) libs/agno/agno/team/_run.py:629 — libs/agno/agno/team/_run.py:629-682 | libs/agno/agno/team/_run.py:1526-1584 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:629` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:626` calls `raise_if_cancelled` and `libs/agno/agno/team/_run.py:1525` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (57 lines × 2) · ×3
  • Duplicated block (57 lines × 2) libs/agno/agno/agent/_run.py:4734 — libs/agno/agno/agent/_run.py:4734-4790 | libs/agno/agno/agent/_run.py:5252-5308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:4734` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_run.py:4731` calls `log_debug` and `libs/agno/agno/agent/_run.py:5250` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (57 lines × 2) libs/agno/agno/db/postgres/postgres.py:6507 — libs/agno/agno/db/postgres/postgres.py:6507-6563 | REDACTED:6291-6347 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (57 lines × 2) libs/agno/agno/workflow/workflow.py:4927 — libs/agno/agno/workflow/workflow.py:4927-4983 | libs/agno/agno/workflow/workflow.py:5130-5186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:4996` calls `upsert_run`, `_apersist_session_and_run` and `libs/agno/agno/workflow/workflow.py:5189` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (53 lines × 2) · ×3
  • Duplicated block (53 lines × 2) libs/agno/agno/run/agent.py:78 — libs/agno/agno/run/agent.py:78-130 | libs/agno/agno/run/team.py:64-116 — before extracting anything, compare `libs/agno/agno/run/agent.py` and `libs/agno/agno/run/team.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 181 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (53 lines × 2) libs/agno/agno/workflow/workflow.py:8147 — libs/agno/agno/workflow/workflow.py:8147-8199 | libs/agno/agno/workflow/workflow.py:9907-9959 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:8147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (53 lines × 2) libs/agno/agno/workflow/workflow.py:8203 — libs/agno/agno/workflow/workflow.py:8203-8255 | libs/agno/agno/workflow/workflow.py:9963-10015 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (47 lines × 2) · ×3
  • Duplicated block (47 lines × 2) REDACTED:694 — REDACTED:694-740 | REDACTED:824-870 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:694` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (47 lines × 2) libs/agno/agno/db/postgres/postgres.py:5358 — libs/agno/agno/db/postgres/postgres.py:5358-5404 | REDACTED:5197-5243 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5358` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (47 lines × 2) libs/agno/agno/team/_run.py:766 — libs/agno/agno/team/_run.py:766-812 | libs/agno/agno/team/_run.py:1632-1678 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×3
  • Duplicated block (43 lines × 2) libs/agno/agno/os/interfaces/a2a/router.py:242 — libs/agno/agno/os/interfaces/a2a/router.py:242-284 | libs/agno/agno/os/interfaces/a2a/router.py:571-613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/interfaces/a2a/router.py:240` calls `HTTPException`, `isinstance` and `libs/agno/agno/os/interfaces/a2a/router.py:570` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (43 lines × 2) libs/agno/agno/scheduler/manager.py:223 — libs/agno/agno/scheduler/manager.py:223-265 | libs/agno/agno/scheduler/manager.py:473-515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/scheduler/manager.py:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (43 lines × 2) libs/agno/agno/team/team.py:1896 — libs/agno/agno/team/team.py:1896-1938 | libs/agno/agno/workflow/workflow.py:11927-11969 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `Registry` names `agno.registry` in one and `agno.registry.registry` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (40–43 lines × 2) · ×3
  • Duplicated block (40–43 lines × 2) libs/agno/agno/tools/reddit.py:357 — libs/agno/agno/tools/reddit.py:357-399 | libs/agno/agno/tools/reddit.py:438-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/reddit.py:357` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (40–43 lines × 2) REDACTED:1588 — REDACTED:1588-1627 | REDACTED:1441-1483 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (40–43 lines × 2) libs/agno/agno/workflow/router.py:797 — libs/agno/agno/workflow/router.py:797-836 | libs/agno/agno/workflow/router.py:1134-1176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/router.py:1134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×3
  • Duplicated block (40 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:501 — libs/agno/agno/db/gcs_json/gcs_json_db.py:501-540 | libs/agno/agno/db/json/json_db.py:550-589 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (40 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1235 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1235-1274 | libs/agno/agno/db/json/json_db.py:1304-1343 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (40 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1790 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1790-1829 | libs/agno/agno/db/json/json_db.py:1890-1929 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (37 lines × 4) · ×3
  • Duplicated block (37 lines × 4) libs/agno/agno/team/_run.py:318 — libs/agno/agno/team/_run.py:318-354 | libs/agno/agno/team/_run.py:668-704 | libs/agno/agno/team/_run.py:1207-1243 | libs/agno/agno/team/_run.py:1570-1606 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:318` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (37 lines × 4) libs/agno/agno/workflow/workflow.py:3164 — libs/agno/agno/workflow/workflow.py:3164-3200 | libs/agno/agno/workflow/workflow.py:3689-3725 | libs/agno/agno/workflow/workflow.py:4169-4205 | libs/agno/agno/workflow/workflow.py:4734-4770 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (37 lines × 4) cookbook/04_workflows/08_human_in_the_loop/executor_hitl/04_agent_confirmation_in_condition_step.py:46 — cookbook/04_workflows/08_human_in_the_loop/executor_hitl/04_agent_confirmation_in_condition_step.py:46-86 | cookbook/04_workflows/08_human_in_the_loop/executor_hitl/05_agent_confirmation_in_loop_step.py:43-79 | cookbook/04_workflows/08_human_in_the_loop/executor_hitl/06_agent_confirmation_in_steps_container.py:44-90 | cookbook/04_workflows/08_human_in_the_loop/executor_hitl/07_agent_confirmation_in_router_step.py:48-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (35 lines × 3) · ×3
  • Duplicated block (35 lines × 3) libs/agno/agno/db/gcs_json/utils.py:14 — libs/agno/agno/db/gcs_json/utils.py:14-48 | libs/agno/agno/db/in_memory/utils.py:14-48 | libs/agno/agno/db/json/utils.py:14-48 — `libs/agno/agno/db/gcs_json/utils.py` and `libs/agno/agno/db/in_memory/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 176 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (35 lines × 3) libs/agno/agno/db/mysql/mysql.py:3265 — libs/agno/agno/db/mysql/mysql.py:3265-3299 | libs/agno/agno/db/postgres/postgres.py:4330-4364 | libs/agno/agno/db/singlestore/singlestore.py:3217-3251 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (35 lines × 3) libs/agno_infra/agno/cli/infra_cli.py:167 — libs/agno_infra/agno/cli/infra_cli.py:167-201 | libs/agno_infra/agno/cli/infra_cli.py:356-390 | libs/agno_infra/agno/cli/infra_cli.py:547-581 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno_infra/agno/cli/infra_cli.py:164` calls `cast` and `libs/agno_infra/agno/cli/infra_cli.py:353` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (33–35 lines × 2) · ×3
  • Duplicated block (33–35 lines × 2) libs/agno/agno/knowledge/chunking/document.py:104 — libs/agno/agno/knowledge/chunking/document.py:104-138 | libs/agno/agno/knowledge/chunking/markdown.py:297-329 — before extracting anything, compare `libs/agno/agno/knowledge/chunking/document.py` and `libs/agno/agno/knowledge/chunking/markdown.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (33–35 lines × 2) libs/agno/agno/utils/print_response/team.py:248 — libs/agno/agno/utils/print_response/team.py:248-282 | libs/agno/agno/utils/print_response/team.py:1183-1215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/team.py:248` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (33–35 lines × 2) libs/agno/agno/workflow/workflow.py:3209 — libs/agno/agno/workflow/workflow.py:3209-3243 | libs/agno/agno/workflow/workflow.py:4215-4247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (32 lines × 3) · ×3
  • Duplicated block (32 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1383 — libs/agno/agno/db/mysql/async_mysql.py:1383-1414 | libs/agno/agno/db/mysql/mysql.py:1367-1398 | libs/agno/agno/db/singlestore/singlestore.py:1418-1449 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (32 lines × 3) libs/agno/agno/db/postgres/postgres.py:2201 — libs/agno/agno/db/postgres/postgres.py:2201-2232 | libs/agno/agno/db/postgres/postgres.py:2259-2290 | libs/agno/agno/db/postgres/postgres.py:2317-2348 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (32 lines × 3) libs/agno/agno/team/_run.py:7607 — libs/agno/agno/team/_run.py:7607-7638 | libs/agno/agno/team/_run.py:7861-7892 | libs/agno/agno/team/_run.py:7928-7959 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:7853` calls `_handle_team_tool_call_updates` and `libs/agno/agno/team/_run.py:7605` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (30–31 lines × 3) · ×3
  • Duplicated block (30–31 lines × 3) libs/agno/agno/db/firestore/utils.py:136 — libs/agno/agno/db/firestore/utils.py:136-165 | libs/agno/agno/db/redis/utils.py:94-124 | libs/agno/agno/db/valkey/utils.py:139-169 — `libs/agno/agno/db/firestore/utils.py` and `libs/agno/agno/db/redis/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 160 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (30–31 lines × 3) libs/agno/agno/db/mysql/mysql.py:1356 — libs/agno/agno/db/mysql/mysql.py:1356-1386 | libs/agno/agno/db/singlestore/singlestore.py:1408-1437 | REDACTED:2118-2148 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30–31 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:191 — libs/agno/agno/os/interfaces/a2a/router.py:191-220 | libs/agno/agno/os/interfaces/a2a/router.py:522-551 | libs/agno/agno/os/interfaces/a2a/router.py:840-870 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (30–31 lines × 2) · ×3
  • Duplicated block (30–31 lines × 2) REDACTED:292 — REDACTED:292-322 | REDACTED:617-646 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (30–31 lines × 2) libs/agno/agno/team/_run.py:2849 — libs/agno/agno/team/_run.py:2849-2879 | libs/agno/agno/team/_run.py:3911-3940 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2849` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:3941` calls `merge_background_metrics`, `collect_background_metrics` and `libs/agno/agno/team/_run.py:2881` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (30–31 lines × 2) libs/agno/agno/workflow/condition.py:895 — libs/agno/agno/workflow/condition.py:895-924 | libs/agno/agno/workflow/condition.py:1349-1379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:895` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×3
  • Duplicated block (29–31 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6084 — libs/agno/agno/db/postgres/async_postgres.py:6084-6112 | REDACTED:5253-5283 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (29–31 lines × 2) libs/agno/agno/db/redis/redis.py:1513 — libs/agno/agno/db/redis/redis.py:1513-1541 | libs/agno/agno/db/valkey/valkey.py:1888-1918 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (29–31 lines × 2) libs/agno/agno/team/_run.py:3111 — libs/agno/agno/team/_run.py:3111-3139 | libs/agno/agno/team/_run.py:3686-3716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:3717` calls `cast` and `libs/agno/agno/team/_run.py:3142` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (28–30 lines × 2) · ×3
  • Duplicated block (28–30 lines × 2) cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:145 — cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:145-172 | cookbook/04_workflows/08_human_in_the_loop/loop/02_loop_confirmation_streaming.py:132-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (28–30 lines × 2) libs/agno/agno/agent/_run_options.py:47 — libs/agno/agno/agent/_run_options.py:47-76 | libs/agno/agno/team/_run_options.py:47-74 — `libs/agno/agno/agent/_run_options.py` and `libs/agno/agno/team/_run_options.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (28–30 lines × 2) libs/agno/agno/db/postgres/postgres.py:5848 — libs/agno/agno/db/postgres/postgres.py:5848-5877 | REDACTED:5639-5666 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29 lines × 3) · ×3
  • Duplicated block (29 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2113 — libs/agno/agno/db/mysql/async_mysql.py:2113-2141 | libs/agno/agno/db/postgres/async_postgres.py:2442-2470 | REDACTED:2640-2668 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (29 lines × 3) libs/agno/agno/os/routers/agents/router.py:739 — libs/agno/agno/os/routers/agents/router.py:739-767 | libs/agno/agno/os/routers/teams/router.py:653-681 | libs/agno/agno/os/routers/workflows/router.py:1831-1859 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/agents/router.py:735` calls `parse_files_metadata` and `libs/agno/agno/os/routers/workflows/router.py:1827` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (29 lines × 3) libs/agno/agno/team/_run.py:2981 — libs/agno/agno/team/_run.py:2981-3009 | libs/agno/agno/team/_run.py:4051-4079 | libs/agno/agno/team/_run.py:10450-10478 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:10448` calls `TeamRunOutput`, `cast` and `libs/agno/agno/team/_run.py:4050` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (26–28 lines × 2) · ×3
  • Duplicated block (26–28 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:767 — libs/agno/agno/db/mysql/async_mysql.py:767-792 | libs/agno/agno/db/postgres/async_postgres.py:1106-1133 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (26–28 lines × 2) libs/agno/agno/utils/media_offload.py:198 — libs/agno/agno/utils/media_offload.py:198-225 | libs/agno/agno/utils/media_offload.py:409-434 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (26–28 lines × 2) libs/agno/agno/workflow/workflow.py:8096 — libs/agno/agno/workflow/workflow.py:8096-8121 | libs/agno/agno/workflow/workflow.py:9854-9881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–24 lines × 2) · ×3
  • Duplicated block (20–24 lines × 2) libs/agno/agno/db/filter_converter.py:88 — libs/agno/agno/db/filter_converter.py:88-111 | libs/agno/agno/db/valkey/utils.py:258-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (20–24 lines × 2) libs/agno/agno/team/_run.py:4665 — libs/agno/agno/team/_run.py:4665-4688 | libs/agno/agno/team/_run.py:4891-4910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20–24 lines × 2) libs/agno/agno/team/_run.py:4748 — libs/agno/agno/team/_run.py:4748-4771 | libs/agno/agno/team/_run.py:4951-4970 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23 lines × 4) · ×3
  • Duplicated block (23 lines × 4) REDACTED:369 — REDACTED:369-391 | REDACTED:501-523 | REDACTED:690-712 | REDACTED:820-842 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:369` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:6951 — libs/agno/agno/db/postgres/async_postgres.py:6951-6973 | libs/agno/agno/db/postgres/postgres.py:9686-9708 | REDACTED:6120-6142 | REDACTED:8615-8637 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (23 lines × 4) libs/agno/agno/workflow/router.py:728 — libs/agno/agno/workflow/router.py:728-750 | libs/agno/agno/workflow/router.py:902-924 | libs/agno/agno/workflow/router.py:1065-1087 | libs/agno/agno/workflow/router.py:1243-1265 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/router.py:1062` calls `getattr`, `log_debug` and `libs/agno/agno/workflow/router.py:726` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (21–23 lines × 2) · ×3
  • Duplicated block (21–23 lines × 2) libs/agno/agno/db/postgres/postgres.py:6975 — libs/agno/agno/db/postgres/postgres.py:6975-6997 | REDACTED:6746-6766 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21–23 lines × 2) libs/agno/agno/eval/performance.py:513 — libs/agno/agno/eval/performance.py:513-533 | libs/agno/agno/eval/performance.py:651-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/eval/performance.py:651` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21–23 lines × 2) libs/agno/agno/utils/agent.py:1239 — libs/agno/agno/utils/agent.py:1239-1261 | libs/agno/agno/utils/agent.py:1299-1319 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21–22 lines × 3) · ×3
  • Duplicated block (21–22 lines × 3) libs/agno/agno/db/json/json_db.py:1991 — libs/agno/agno/db/json/json_db.py:1991-2011 | libs/agno/agno/db/redis/redis.py:2281-2302 | libs/agno/agno/db/valkey/valkey.py:2776-2797 — before extracting anything, compare `libs/agno/agno/db/json/json_db.py` and `libs/agno/agno/db/redis/redis.py` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 342 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/valkey/valkey.py:2775` calls `record_matches_filter_expr` and `libs/agno/agno/db/json/json_db.py:1990` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21–22 lines × 3) libs/agno/agno/team/_default_tools.py:726 — libs/agno/agno/team/_default_tools.py:726-747 | libs/agno/agno/team/_task_tools.py:530-550 | libs/agno/agno/team/_task_tools.py:713-733 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:726` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21–22 lines × 3) libs/agno/agno/tools/studio_runner.py:2027 — libs/agno/agno/tools/studio_runner.py:2027-2048 | libs/agno/agno/tools/studio_runner.py:2080-2100 | libs/agno/agno/tools/studio_runner.py:2136-2156 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio_runner.py:2027` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–21 lines × 6) · ×3
  • Duplicated block (20–21 lines × 6) REDACTED:243 — REDACTED:243-263 | REDACTED:359-379 | REDACTED:491-511 | REDACTED:558-577 | REDACTED:681-700 | REDACTED:811-830 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (20–21 lines × 6) REDACTED:207 — REDACTED:207-227 | REDACTED:303-323 | REDACTED:402-422 | REDACTED:541-560 | REDACTED:628-647 | REDACTED:716-735 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (20–21 lines × 6) libs/agno/agno/reasoning/deepseek.py:44 — libs/agno/agno/reasoning/deepseek.py:44-63 | libs/agno/agno/reasoning/deepseek.py:123-142 | libs/agno/agno/reasoning/gemini.py:65-84 | libs/agno/agno/reasoning/gemini.py:95-114 | libs/agno/agno/reasoning/moonshot.py:81-101 | libs/agno/agno/reasoning/moonshot.py:116-135 — before extracting anything, compare `libs/agno/agno/reasoning/deepseek.py` and `libs/agno/agno/reasoning/gemini.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 114 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–21 lines × 4) · ×3
  • Duplicated block (19–21 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3291 — libs/agno/agno/db/postgres/async_postgres.py:3291-3309 | libs/agno/agno/db/postgres/postgres.py:3835-3853 | REDACTED:3440-3460 | REDACTED:3636-3656 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3291` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–21 lines × 4) libs/agno/agno/os/interfaces/a2a/router.py:210 — libs/agno/agno/os/interfaces/a2a/router.py:210-230 | libs/agno/agno/os/interfaces/a2a/router.py:263-281 | libs/agno/agno/os/interfaces/a2a/router.py:541-561 | libs/agno/agno/os/interfaces/a2a/router.py:592-610 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/interfaces/a2a/router.py:231` calls `get` and `libs/agno/agno/os/interfaces/a2a/router.py:283` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19–21 lines × 4) libs/agno/agno/workflow/workflow.py:4938 — libs/agno/agno/workflow/workflow.py:4938-4958 | libs/agno/agno/workflow/workflow.py:5141-5161 | libs/agno/agno/workflow/workflow.py:10679-10697 | libs/agno/agno/workflow/workflow.py:10932-10950 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:4938` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×3
  • Duplicated block (17–21 lines × 2) libs/agno/agno/team/_default_tools.py:796 — libs/agno/agno/team/_default_tools.py:796-816 | libs/agno/agno/team/_task_tools.py:590-606 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:796` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (17–21 lines × 2) libs/agno/agno/team/_messages.py:438 — libs/agno/agno/team/_messages.py:438-458 | libs/agno/agno/team/_messages.py:696-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–21 lines × 2) libs/agno/agno/workflow/workflow.py:7510 — libs/agno/agno/workflow/workflow.py:7510-7530 | libs/agno/agno/workflow/workflow.py:7750-7766 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:7535` calls `_find_paused_executor_run` and `libs/agno/agno/workflow/workflow.py:7771` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–20 lines × 4) · ×3
  • Duplicated block (19–20 lines × 4) libs/agno/agno/db/mysql/mysql.py:2641 — libs/agno/agno/db/mysql/mysql.py:2641-2660 | libs/agno/agno/db/postgres/postgres.py:3588-3607 | libs/agno/agno/db/singlestore/singlestore.py:2637-2656 | REDACTED:3448-3466 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:2641` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 4) libs/agno/agno/team/_run.py:2195 — libs/agno/agno/team/_run.py:2195-2213 | libs/agno/agno/team/_run.py:2578-2596 | libs/agno/agno/team/_run.py:3171-3190 | libs/agno/agno/team/_run.py:3746-3765 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:2195` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 4) REDACTED:571 — REDACTED:571-589 | REDACTED:665-684 | REDACTED:745-763 | REDACTED:845-863 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:569` calls `log_debug` and `REDACTED:744` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×3
  • Duplicated block (17–20 lines × 2) cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:68 — cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:68-84 | cookbook/10_reasoning/tools/capture_reasoning_content_reasoning_tools.py:36-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:68` calls `hasattr` and `cookbook/10_reasoning/tools/capture_reasoning_content_reasoning_tools.py:36` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17–20 lines × 2) cookbook/12_context/15a_wiki_notion.py:103 — cookbook/12_context/15a_wiki_notion.py:103-122 | cookbook/12_context/16_wiki_with_web.py:71-87 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17–20 lines × 2) libs/agno/agno/workflow/router.py:652 — libs/agno/agno/workflow/router.py:652-668 | libs/agno/agno/workflow/router.py:983-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/router.py:983` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16–19 lines × 2) · ×3
  • Duplicated block (16–19 lines × 2) libs/agno/agno/models/groq/groq.py:499 — libs/agno/agno/models/groq/groq.py:499-514 | libs/agno/agno/models/perplexity/perplexity.py:119-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/perplexity/perplexity.py:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `ChatCompletion` names `groq.types.chat` in one and `openai.types.chat.chat_completion` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (16–19 lines × 2) libs/agno/agno/team/_task_tools.py:955 — libs/agno/agno/team/_task_tools.py:955-973 | libs/agno/agno/team/_task_tools.py:1174-1189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–19 lines × 2) REDACTED:2831 — REDACTED:2831-2846 | REDACTED:2222-2240 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (15–18 lines × 3) · ×3
  • Duplicated block (15–18 lines × 3) libs/agno/agno/team/_run.py:407 — libs/agno/agno/team/_run.py:407-421 | libs/agno/agno/team/_run.py:1281-1298 | libs/agno/agno/team/_run.py:8244-8261 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1281` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–18 lines × 3) libs/agno/agno/team/_run.py:535 — libs/agno/agno/team/_run.py:535-549 | libs/agno/agno/team/_run.py:1381-1398 | libs/agno/agno/team/_run.py:8322-8338 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–18 lines × 3) libs/agno/agno/team/_run.py:2304 — libs/agno/agno/team/_run.py:2304-2318 | libs/agno/agno/team/_run.py:3274-3291 | libs/agno/agno/team/_run.py:6877-6893 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:3274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×3
  • Duplicated block (15–18 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2630 — libs/agno/agno/db/postgres/async_postgres.py:2630-2644 | REDACTED:2824-2841 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–18 lines × 2) libs/agno/agno/tools/google/calendar.py:147 — libs/agno/agno/tools/google/calendar.py:147-164 | libs/agno/agno/tools/google/gmail.py:308-322 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/google/calendar.py:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (15–18 lines × 2) libs/agno/agno/tools/lumalab.py:94 — libs/agno/agno/tools/lumalab.py:94-111 | libs/agno/agno/tools/lumalab.py:152-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/lumalab.py:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–18 lines × 2) · ×3
  • Duplicated block (14–18 lines × 2) libs/agno/agno/db/postgres/postgres.py:2022 — libs/agno/agno/db/postgres/postgres.py:2022-2039 | libs/agno/agno/db/singlestore/singlestore.py:1248-1261 — `libs/agno/agno/db/postgres/postgres.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 95 separate duplicated blocks between them, totalling at least 1565 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–18 lines × 2) libs/agno/agno/eval/performance.py:281 — libs/agno/agno/eval/performance.py:281-298 | libs/agno/agno/eval/performance.py:340-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14–18 lines × 2) libs/agno/agno/os/router.py:735 — libs/agno/agno/os/router.py:735-752 | libs/agno/agno/os/router.py:837-850 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/router.py:735` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17 lines × 6) · ×3
  • Duplicated block (17 lines × 6) cookbook/12_context/18_gmail.py:67 — cookbook/12_context/18_gmail.py:67-83 | cookbook/12_context/18_gmail.py:102-118 | cookbook/12_context/19_calendar.py:103-119 | cookbook/12_context/25_write_tools_restriction.py:65-81 | cookbook/12_context/25_write_tools_restriction.py:110-126 | cookbook/12_context/25_write_tools_restriction.py:157-173 — before extracting anything, compare `cookbook/12_context/18_gmail.py` and `cookbook/12_context/19_calendar.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/12_context/18_gmail.py:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 6) libs/agno/agno/db/mysql/async_mysql.py:2826 — libs/agno/agno/db/mysql/async_mysql.py:2826-2842 | libs/agno/agno/db/mysql/mysql.py:2793-2809 | libs/agno/agno/db/postgres/async_postgres.py:3200-3216 | libs/agno/agno/db/postgres/postgres.py:3744-3760 | libs/agno/agno/db/singlestore/singlestore.py:2734-2750 | REDACTED:3352-3368 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2826` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 6) libs/agno_infra/agno/cli/operator.py:95 — libs/agno_infra/agno/cli/operator.py:95-112 | libs/agno_infra/agno/cli/operator.py:169-186 | libs/agno_infra/agno/cli/operator.py:242-258 | libs/agno_infra/agno/infra/operator.py:244-261 | libs/agno_infra/agno/infra/operator.py:316-333 | libs/agno_infra/agno/infra/operator.py:389-405 — `libs/agno_infra/agno/cli/operator.py` and `libs/agno_infra/agno/infra/operator.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 123 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/cli/operator.py:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16 lines × 7) · ×3
  • Duplicated block (16 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:756 — libs/agno/agno/db/mysql/async_mysql.py:756-771 | libs/agno/agno/db/mysql/mysql.py:746-761 | libs/agno/agno/db/postgres/async_postgres.py:1095-1110 | libs/agno/agno/db/postgres/postgres.py:1244-1259 | libs/agno/agno/db/singlestore/singlestore.py:803-818 | REDACTED:1046-1061 | REDACTED:1231-1246 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2837 — libs/agno/agno/db/mysql/async_mysql.py:2837-2852 | libs/agno/agno/db/mysql/mysql.py:2804-2819 | libs/agno/agno/db/postgres/async_postgres.py:3211-3226 | libs/agno/agno/db/postgres/postgres.py:3755-3770 | libs/agno/agno/db/singlestore/singlestore.py:2745-2760 | REDACTED:3363-3378 | REDACTED:3559-3574 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 7) libs/agno/agno/workflow/workflow.py:3443 — libs/agno/agno/workflow/workflow.py:3443-3458 | libs/agno/agno/workflow/workflow.py:8018-8033 | libs/agno/agno/workflow/workflow.py:8123-8138 | libs/agno/agno/workflow/workflow.py:8286-8301 | libs/agno/agno/workflow/workflow.py:9777-9792 | libs/agno/agno/workflow/workflow.py:9883-9898 | libs/agno/agno/workflow/workflow.py:10046-10061 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (16 lines × 5) · ×3
  • Duplicated block (16 lines × 5) libs/agno/agno/workflow/condition.py:565 — libs/agno/agno/workflow/condition.py:565-580 | libs/agno/agno/workflow/loop.py:470-485 | libs/agno/agno/workflow/parallel.py:354-369 | libs/agno/agno/workflow/router.py:669-684 | libs/agno/agno/workflow/steps.py:284-299 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
  • Duplicated block (16 lines × 5) libs/agno/agno/workflow/condition.py:870 — libs/agno/agno/workflow/condition.py:870-885 | libs/agno/agno/workflow/condition.py:1324-1339 | libs/agno/agno/workflow/router.py:725-740 | libs/agno/agno/workflow/router.py:899-914 | libs/agno/agno/workflow/router.py:1240-1255 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 5) libs/agno/agno/workflow/condition.py:1020 — libs/agno/agno/workflow/condition.py:1020-1035 | libs/agno/agno/workflow/loop.py:868-883 | libs/agno/agno/workflow/parallel.py:722-737 | libs/agno/agno/workflow/router.py:1003-1018 | libs/agno/agno/workflow/steps.py:590-605 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×3
  • Duplicated block (14–16 lines × 2) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:103 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:103-118 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:88-101 — before extracting anything, compare `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py` and `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14–16 lines × 2) libs/agno/agno/knowledge/chunking/document.py:85 — libs/agno/agno/knowledge/chunking/document.py:85-98 | libs/agno/agno/knowledge/chunking/markdown.py:275-290 — before extracting anything, compare `libs/agno/agno/knowledge/chunking/document.py` and `libs/agno/agno/knowledge/chunking/markdown.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/chunking/document.py:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–16 lines × 2) libs/agno/agno/tools/function.py:611 — libs/agno/agno/tools/function.py:611-624 | libs/agno/agno/tools/function.py:1509-1524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×3
  • Duplicated block (12–16 lines × 2) libs/agno/agno/agent/_run.py:6035 — libs/agno/agno/agent/_run.py:6035-6050 | libs/agno/agno/agent/_run.py:6076-6087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–16 lines × 2) libs/agno/agno/learn/stores/entity_memory.py:476 — libs/agno/agno/learn/stores/entity_memory.py:476-491 | libs/agno/agno/learn/stores/entity_memory.py:526-537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/entity_memory.py:476` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–16 lines × 2) libs/agno/agno/team/_run.py:7846 — libs/agno/agno/team/_run.py:7846-7861 | libs/agno/agno/team/_run.py:8082-8093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:7846` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×3
  • Duplicated block (13–16 lines × 2) libs/agno/agno/os/authz/_role_store.py:513 — libs/agno/agno/os/authz/_role_store.py:513-528 | libs/agno/agno/os/authz/_role_store.py:1019-1031 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–16 lines × 2) libs/agno/agno/team/_run.py:6449 — libs/agno/agno/team/_run.py:6449-6464 | libs/agno/agno/team/_run.py:6559-6571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–16 lines × 2) libs/agno/agno/team/_task_tools.py:1005 — libs/agno/agno/team/_task_tools.py:1005-1020 | libs/agno/agno/team/_task_tools.py:1218-1230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_task_tools.py:1218` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 5) · ×3
  • Duplicated block (13 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:810 — libs/agno/agno/db/mysql/async_mysql.py:810-822 | libs/agno/agno/db/mysql/mysql.py:807-819 | libs/agno/agno/db/singlestore/singlestore.py:863-875 | REDACTED:1112-1124 | REDACTED:1299-1311 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `sid` to `sessions_table.c.runs).where(sessions_table.c.runs.isnot(None)) ) rows = result.fetchall() for` in one and `sessions_table.c.runs).where(sessions_table.c.runs.isnot(None)) ).fetchall() for` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:2097 — libs/agno/agno/db/mysql/async_mysql.py:2097-2109 | libs/agno/agno/db/mysql/mysql.py:2068-2080 | libs/agno/agno/db/singlestore/singlestore.py:2093-2105 | REDACTED:2624-2636 | REDACTED:2878-2890 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:2369 — libs/agno/agno/db/mysql/async_mysql.py:2369-2381 | libs/agno/agno/db/mysql/mysql.py:2339-2351 | libs/agno/agno/db/singlestore/singlestore.py:2363-2375 | REDACTED:2915-2927 | REDACTED:3169-3181 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 8) · ×3
  • Duplicated block (11 lines × 8) libs/agno/agno/db/postgres/async_postgres.py:6436 — libs/agno/agno/db/postgres/async_postgres.py:6436-6446 | libs/agno/agno/db/postgres/async_postgres.py:6547-6557 | libs/agno/agno/db/postgres/async_postgres.py:6665-6675 | libs/agno/agno/db/postgres/async_postgres.py:6913-6923 | REDACTED:5605-5615 | REDACTED:5716-5726 | REDACTED:5834-5844 | REDACTED:6082-6092 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 8) libs/agno/agno/db/postgres/postgres.py:9189 — libs/agno/agno/db/postgres/postgres.py:9189-9199 | libs/agno/agno/db/postgres/postgres.py:9294-9304 | libs/agno/agno/db/postgres/postgres.py:9410-9420 | libs/agno/agno/db/postgres/postgres.py:9648-9658 | REDACTED:8118-8128 | REDACTED:8223-8233 | REDACTED:8339-8349 | REDACTED:8577-8587 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 8) libs/agno/agno/reasoning/azure_ai_foundry.py:106 — libs/agno/agno/reasoning/azure_ai_foundry.py:106-116 | libs/agno/agno/reasoning/azure_ai_foundry.py:152-162 | libs/agno/agno/reasoning/groq.py:122-132 | libs/agno/agno/reasoning/groq.py:173-183 | libs/agno/agno/reasoning/ollama.py:163-173 | libs/agno/agno/reasoning/ollama.py:209-219 | libs/agno/agno/reasoning/openai.py:145-155 | libs/agno/agno/reasoning/openai.py:201-211 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–11 lines × 4) · ×3
  • Duplicated block (9–11 lines × 4) libs/agno/agno/db/mysql/mysql.py:705 — libs/agno/agno/db/mysql/mysql.py:705-714 | libs/agno/agno/db/postgres/postgres.py:1082-1092 | libs/agno/agno/db/singlestore/singlestore.py:767-775 | REDACTED:1073-1083 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1084` calls `isinstance`, `get`, `loads` and `libs/agno/agno/db/mysql/mysql.py:716` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9–11 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:5275 — libs/agno/agno/db/postgres/async_postgres.py:5275-5285 | libs/agno/agno/db/postgres/async_postgres.py:5368-5376 | libs/agno/agno/db/postgres/async_postgres.py:5399-5407 | libs/agno/agno/db/postgres/async_postgres.py:5479-5489 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:5275` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–11 lines × 4) libs/agno/agno/db/postgres/utils.py:231 — libs/agno/agno/db/postgres/utils.py:231-241 | libs/agno/agno/db/postgres/utils.py:266-276 | libs/agno/agno/db/sqlite/utils.py:195-203 | libs/agno/agno/db/sqlite/utils.py:228-236 — `libs/agno/agno/db/postgres/utils.py` and `libs/agno/agno/db/sqlite/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 213 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×3
  • Duplicated block (10 lines × 6) libs/agno/agno/client/os.py:683 — libs/agno/agno/client/os.py:683-692 | libs/agno/agno/client/os.py:725-734 | libs/agno/agno/client/os.py:984-993 | libs/agno/agno/client/os.py:1038-1047 | libs/agno/agno/client/os.py:1275-1284 | libs/agno/agno/client/os.py:1325-1334 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 6) libs/agno/agno/db/base.py:483 — libs/agno/agno/db/base.py:483-492 | libs/agno/agno/db/base.py:2759-2768 | libs/agno/agno/db/postgres/async_postgres.py:270-279 | libs/agno/agno/db/postgres/postgres.py:306-315 | REDACTED:256-265 | REDACTED:304-313 — before extracting anything, compare `libs/agno/agno/db/base.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:267` calls `get` and `libs/agno/agno/db/base.py:2757` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 6) libs/agno/agno/db/postgres/postgres.py:7231 — libs/agno/agno/db/postgres/postgres.py:7231-7240 | libs/agno/agno/db/postgres/postgres.py:7482-7491 | libs/agno/agno/db/postgres/postgres.py:8770-8779 | REDACTED:6999-7008 | REDACTED:7267-7276 | REDACTED:7702-7711 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–10 lines × 4) · ×3
  • Duplicated block (8–10 lines × 4) libs/agno/agno/db/mysql/mysql.py:2293 — libs/agno/agno/db/mysql/mysql.py:2293-2301 | libs/agno/agno/db/postgres/postgres.py:3198-3207 | libs/agno/agno/db/singlestore/singlestore.py:2317-2324 | REDACTED:3122-3131 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–10 lines × 4) libs/agno/agno/db/mysql/mysql.py:2696 — libs/agno/agno/db/mysql/mysql.py:2696-2703 | libs/agno/agno/db/postgres/postgres.py:3645-3654 | libs/agno/agno/db/singlestore/singlestore.py:2692-2699 | REDACTED:3505-3512 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/postgres.py:3644` calls `sanitize_postgres_string` and `libs/agno/agno/db/mysql/mysql.py:2695` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–10 lines × 4) libs/agno/agno/workflow/workflow.py:2969 — libs/agno/agno/workflow/workflow.py:2969-2976 | libs/agno/agno/workflow/workflow.py:3259-3267 | libs/agno/agno/workflow/workflow.py:3324-3331 | libs/agno/agno/workflow/workflow.py:3772-3781 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3772` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×3
  • Duplicated block (9 lines × 5) libs/agno/agno/db/postgres/async_postgres.py:1842 — libs/agno/agno/db/postgres/async_postgres.py:1842-1850 | libs/agno/agno/db/postgres/postgres.py:2073-2081 | libs/agno/agno/db/postgres/postgres.py:2204-2212 | libs/agno/agno/db/postgres/postgres.py:2262-2270 | libs/agno/agno/db/postgres/postgres.py:2320-2328 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 5) libs/agno/agno/os/routers/teams/router.py:2093 — libs/agno/agno/os/routers/teams/router.py:2093-2101 | libs/agno/agno/os/routers/teams/router.py:2142-2150 | libs/agno/agno/os/routers/teams/router.py:2237-2245 | libs/agno/agno/os/routers/teams/router.py:2302-2310 | libs/agno/agno/os/routers/teams/router.py:2367-2375 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/teams/router.py:2142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/teams/router.py:2092` calls `HTTPException`, `str` and `libs/agno/agno/os/routers/teams/router.py:2142` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 5) libs/agno/agno/workflow/parallel.py:942 — libs/agno/agno/workflow/parallel.py:942-950 | libs/agno/agno/workflow/router.py:738-746 | libs/agno/agno/workflow/router.py:912-920 | libs/agno/agno/workflow/router.py:1075-1083 | libs/agno/agno/workflow/router.py:1253-1261 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/parallel.py:940` calls `put` and `libs/agno/agno/workflow/router.py:737` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×3
  • Duplicated block (7–9 lines × 2) libs/agno/agno/agents/base.py:838 — libs/agno/agno/agents/base.py:838-846 | libs/agno/agno/agents/base.py:875-881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agents/base.py:872` calls `apersist_worker_owned_run`, `resolve_run_index` and `libs/agno/agno/agents/base.py:837` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–9 lines × 2) libs/agno/agno/tools/bitbucket.py:225 — libs/agno/agno/tools/bitbucket.py:225-233 | libs/agno/agno/tools/bitbucket.py:287-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7–9 lines × 2) REDACTED:258 — REDACTED:258-264 | REDACTED:1247-1255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×3
  • Duplicated block (8 lines × 5) libs/agno/agno/db/dynamo/dynamo.py:1231 — libs/agno/agno/db/dynamo/dynamo.py:1231-1238 | libs/agno/agno/db/dynamo/dynamo.py:1391-1398 | libs/agno/agno/db/dynamo/dynamo.py:1461-1468 | libs/agno/agno/db/dynamo/dynamo.py:2012-2019 | libs/agno/agno/db/dynamo/dynamo.py:2401-2408 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/dynamo/dynamo.py:2022` calls `deserialize_from_dynamodb_item`, `drop_legacy_metrics` and `libs/agno/agno/db/dynamo/dynamo.py:2411` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 5) libs/agno/agno/db/redis/redis.py:2921 — libs/agno/agno/db/redis/redis.py:2921-2928 | libs/agno/agno/db/redis/redis.py:2949-2956 | libs/agno/agno/db/redis/redis.py:3012-3019 | libs/agno/agno/db/redis/redis.py:3049-3056 | libs/agno/agno/db/redis/redis.py:3136-3143 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 5) REDACTED:1755 — REDACTED:1755-1762 | REDACTED:1771-1778 | REDACTED:1787-1794 | REDACTED:1809-1816 | REDACTED:1838-1845 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1808` calls `where` and `REDACTED:1754` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×3
  • Duplicated block (7–8 lines × 3) libs/agno/agno/db/dynamo/dynamo.py:877 — libs/agno/agno/db/dynamo/dynamo.py:877-884 | libs/agno/agno/db/dynamo/dynamo.py:2822-2828 | libs/agno/agno/db/dynamo/dynamo.py:2934-2940 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7–8 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:922 — libs/agno/agno/db/mysql/async_mysql.py:922-928 | libs/agno/agno/db/postgres/async_postgres.py:1329-1336 | REDACTED:1283-1290 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1275` calls `execute`, `where`, `in_` and `libs/agno/agno/db/mysql/async_mysql.py:921` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–8 lines × 3) libs/agno/agno/models/google/gemini.py:1038 — libs/agno/agno/models/google/gemini.py:1038-1045 | libs/agno/agno/models/google/gemini.py:1091-1098 | libs/agno/agno/models/google/gemini.py:1180-1186 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×3
  • Duplicated block (6–7 lines × 2) REDACTED:4496 — REDACTED:4496-4502 | REDACTED:4563-4568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) libs/agno/agno/tools/studio.py:3834 — libs/agno/agno/tools/studio.py:3834-3839 | libs/agno/agno/tools/studio.py:3914-3920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio.py:3914` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6–7 lines × 2) REDACTED:2279 — REDACTED:2279-2284 | REDACTED:2154-2160 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:2288` calls `next`, `iter`, `values` and `REDACTED:2161` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
X1 · Async correctness · Task from `asyncio.create_task` is not kept · ×3
  • Task from `asyncio.create_task` is not kept libs/agno/agno/workflow/workflow.py:2574 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept libs/agno/agno/workflow/workflow.py:2634 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
  • Task from `asyncio.create_task` is not kept libs/agno/agno/tracing/exporter.py:112 — The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
AC3 · Page structure · Page without a main landmark · ×2
  • Page without a main landmark cookbook/07_knowledge/testing_resources/company_info.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark cookbook/data_labeling/image_search/public/index.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
D1 · Cyclomatic Complexity · _run_options.resolve_run_options (cyclomatic 20) · ×2
  • _run_options.resolve_run_options (cyclomatic 20) libs/agno/agno/agent/_run_options.py:79 — _run_options.resolve_run_options has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • _run_options.resolve_run_options (cyclomatic 20) libs/agno/agno/team/_run_options.py:77 — _run_options.resolve_run_options has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _response.update_reasoning_content_from_tool_call (cyclomatic 16) · ×2
  • _response.update_reasoning_content_from_tool_call (cyclomatic 16) libs/agno/agno/agent/_response.py:752 — _response.update_reasoning_content_from_tool_call has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • _response.update_reasoning_content_from_tool_call (cyclomatic 16) libs/agno/agno/team/_response.py:802 — _response.update_reasoning_content_from_tool_call has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.calculate_date_metrics (cyclomatic 16) · ×2
  • utils.calculate_date_metrics (cyclomatic 16) libs/agno/agno/db/mongo/utils.py:140 — utils.calculate_date_metrics has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • utils.calculate_date_metrics (cyclomatic 16) libs/agno/agno/db/sqlite/utils.py:244 — utils.calculate_date_metrics has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · _response.aparse_response_with_parser_model_stream (cognitive 34) · ×2
  • _response.aparse_response_with_parser_model_stream (cognitive 34) libs/agno/agno/agent/_response.py:513 — _response.aparse_response_with_parser_model_stream has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (10 pts), ternaries 1 (2 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • _response.aparse_response_with_parser_model_stream (cognitive 34) libs/agno/agno/team/_response.py:305 — _response.aparse_response_with_parser_model_stream has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (10 pts), ternaries 1 (2 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _response.parse_response_with_parser_model_stream (cognitive 30) · ×2
  • _response.parse_response_with_parser_model_stream (cognitive 30) libs/agno/agno/agent/_response.py:445 — _response.parse_response_with_parser_model_stream has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (6 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • _response.parse_response_with_parser_model_stream (cognitive 30) libs/agno/agno/team/_response.py:234 — _response.parse_response_with_parser_model_stream has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (6 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · cancel_run.long_running_task (cognitive 22) · ×2
  • cancel_run.long_running_task (cognitive 22) cookbook/02_agents/14_advanced/cancel_run.py:17 — cancel_run.long_running_task has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (9 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cancel_run.long_running_task (cognitive 22) cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py:24 — cancel_run.long_running_task has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 4 (6 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run_options.resolve_run_options (cognitive 20) · ×2
  • _run_options.resolve_run_options (cognitive 20) libs/agno/agno/agent/_run_options.py:79 — _run_options.resolve_run_options has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 5, boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • _run_options.resolve_run_options (cognitive 20) libs/agno/agno/team/_run_options.py:77 — _run_options.resolve_run_options has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 5, boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _response.update_reasoning_content_from_tool_call (cognitive 19) · ×2
  • _response.update_reasoning_content_from_tool_call (cognitive 19) libs/agno/agno/agent/_response.py:752 — _response.update_reasoning_content_from_tool_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _response.update_reasoning_content_from_tool_call (cognitive 19) libs/agno/agno/team/_response.py:802 — _response.update_reasoning_content_from_tool_call has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _session.adelete_session (cognitive 19) · ×2
  • _session.adelete_session (cognitive 19) libs/agno/agno/agent/_session.py:402 — _session.adelete_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _session.adelete_session (cognitive 19) libs/agno/agno/team/_session.py:829 — _session.adelete_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _session.delete_session (cognitive 17) · ×2
  • _session.delete_session (cognitive 17) libs/agno/agno/agent/_session.py:358 — _session.delete_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _session.delete_session (cognitive 17) libs/agno/agno/team/_session.py:784 — _session.delete_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _cli.cli_app (cognitive 16) · ×2
  • _cli.cli_app (cognitive 16) libs/agno/agno/agent/_cli.py:239 — _cli.cli_app has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _cli.cli_app (cognitive 16) libs/agno/agno/team/_cli.py:264 — _cli.cli_app has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response.handle_reasoning_event (cognitive 16) · ×2
  • _response.handle_reasoning_event (cognitive 16) libs/agno/agno/agent/_response.py:168 — _response.handle_reasoning_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • _response.handle_reasoning_event (cognitive 16) libs/agno/agno/team/_response.py:582 — _response.handle_reasoning_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamState.collect_media (cognitive 16) · ×2
  • StreamState.collect_media (cognitive 16) libs/agno/agno/os/interfaces/slack/state.py:106 — StreamState.collect_media has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StreamState.collect_media (cognitive 16) libs/agno/agno/os/interfaces/telegram/state.py:197 — StreamState.collect_media has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (7 members, 28 shared lines) · ×2
  • Near-duplicate member family (7 members, 28 shared lines) libs/agno/agno/db/mysql/async_mysql.py:1046 — libs/agno/agno/db/mysql/async_mysql.py:1046-1144 | libs/agno/agno/db/mysql/mysql.py:1039-1137 | libs/agno/agno/db/postgres/async_postgres.py:1627-1733 | libs/agno/agno/db/postgres/postgres.py:1858-1964 | libs/agno/agno/db/singlestore/singlestore.py:1094-1193 | REDACTED:1557-1664 | REDACTED:1814-1920 — These 7 members are variants of one another: a block of 28 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
  • Near-duplicate member family (7 members, 28 shared lines) libs/agno/agno/db/mysql/async_mysql.py:2621 — libs/agno/agno/db/mysql/async_mysql.py:2621-2704 | libs/agno/agno/db/mysql/mysql.py:2589-2672 | libs/agno/agno/db/postgres/async_postgres.py:2993-3076 | libs/agno/agno/db/postgres/postgres.py:3536-3619 | libs/agno/agno/db/singlestore/singlestore.py:2585-2668 | REDACTED:3143-3225 | REDACTED:3396-3478 — These 7 members are variants of one another: a block of 28 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 36 shared lines) · ×2
  • Near-duplicate member family (6 members, 36 shared lines) libs/agno_infra/agno/aws/resources.py:83 — libs/agno_infra/agno/aws/resources.py:83-234 | libs/agno_infra/agno/aws/resources.py:245-389 | libs/agno_infra/agno/aws/resources.py:401-537 | libs/agno_infra/agno/docker/resources.py:41-189 | libs/agno_infra/agno/docker/resources.py:200-353 | libs/agno_infra/agno/docker/resources.py:365-511 — These 6 members are variants of one another: a block of 36 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Near-duplicate member family (6 members, 36 shared lines) libs/agno_infra/agno/cli/operator.py:75 — libs/agno_infra/agno/cli/operator.py:75-136 | libs/agno_infra/agno/cli/operator.py:150-209 | libs/agno_infra/agno/cli/operator.py:223-281 | libs/agno_infra/agno/infra/operator.py:226-286 | libs/agno_infra/agno/infra/operator.py:300-357 | libs/agno_infra/agno/infra/operator.py:372-430 — These 6 members are variants of one another: a block of 36 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 11 shared lines) · ×2
  • Near-duplicate member family (6 members, 11 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6568 — libs/agno/agno/db/postgres/async_postgres.py:6568-6590 | libs/agno/agno/db/postgres/async_postgres.py:6688-6716 | libs/agno/agno/db/postgres/async_postgres.py:6939-6983 | REDACTED:5737-5759 | REDACTED:5857-5885 | REDACTED:6108-6152 — These 6 members are variants of one another: a block of 11 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Near-duplicate member family (6 members, 11 shared lines) libs/agno/agno/db/postgres/postgres.py:9315 — libs/agno/agno/db/postgres/postgres.py:9315-9337 | libs/agno/agno/db/postgres/postgres.py:9433-9461 | libs/agno/agno/db/postgres/postgres.py:9674-9718 | REDACTED:8244-8266 | REDACTED:8362-8390 | REDACTED:8603-8647 — These 6 members are variants of one another: a block of 11 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 36 shared lines) · ×2
  • Near-duplicate member family (5 members, 36 shared lines) libs/agno/agno/db/gcs_json/gcs_json_db.py:1097 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1097-1164 | libs/agno/agno/db/in_memory/in_memory_db.py:938-1002 | libs/agno/agno/db/json/json_db.py:1164-1233 | libs/agno/agno/db/redis/redis.py:1441-1505 | libs/agno/agno/db/valkey/valkey.py:1814-1880 — These 5 members are variants of one another: a block of 36 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Near-duplicate member family (5 members, 36 shared lines) libs/agno/agno/db/mysql/async_mysql.py:1942 — libs/agno/agno/db/mysql/async_mysql.py:1942-2037 | libs/agno/agno/db/mysql/mysql.py:1913-2008 | libs/agno/agno/db/singlestore/singlestore.py:1938-2019 | REDACTED:2446-2544 | REDACTED:2701-2799 — These 5 members are variants of one another: a block of 36 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 23 shared lines) · ×2
  • Near-duplicate member family (4 members, 23 shared lines) libs/agno/agno/db/mongo/async_mongo.py:1565 — libs/agno/agno/db/mongo/async_mongo.py:1565-1630 | libs/agno/agno/db/mongo/async_mongo.py:2365-2446 | libs/agno/agno/db/mongo/mongo.py:1372-1436 | libs/agno/agno/db/mongo/mongo.py:2170-2252 — These 4 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Near-duplicate member family (4 members, 23 shared lines) libs/agno/agno/models/aws/bedrock.py:561 — libs/agno/agno/models/aws/bedrock.py:561-595 | libs/agno/agno/models/aws/bedrock.py:607-645 | libs/agno/agno/models/aws/bedrock.py:657-694 | libs/agno/agno/models/aws/bedrock.py:706-744 — These 4 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 15 shared lines) · ×2
  • Near-duplicate member family (4 members, 15 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6688 — libs/agno/agno/db/postgres/async_postgres.py:6688-6716 | libs/agno/agno/db/postgres/postgres.py:9433-9461 | REDACTED:5857-5885 | REDACTED:8362-8390 — These 4 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Near-duplicate member family (4 members, 15 shared lines) libs/agno/agno/db/postgres/async_postgres.py:7180 — libs/agno/agno/db/postgres/async_postgres.py:7180-7235 | libs/agno/agno/db/postgres/postgres.py:9907-9960 | REDACTED:6349-6404 | REDACTED:8836-8889 — These 4 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 13 shared lines) · ×2
  • Near-duplicate member family (4 members, 13 shared lines) REDACTED:1895 — REDACTED:1895-1935 | REDACTED:1988-2028 | REDACTED:2082-2106 | REDACTED:2149-2172 — These 4 members are variants of one another: a block of 13 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Near-duplicate member family (4 members, 13 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6568 — libs/agno/agno/db/postgres/async_postgres.py:6568-6590 | libs/agno/agno/db/postgres/postgres.py:9315-9337 | REDACTED:5737-5759 | REDACTED:8244-8266 — These 4 members are variants of one another: a block of 13 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member pair (137 shared lines) · ×2
  • Near-duplicate member pair (137 shared lines) libs/agno/agno/team/_run.py:3058 — libs/agno/agno/team/_run.py:3058-3449 | libs/agno/agno/team/_run.py:3632-4128 — These two members are variants of one another: 137 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (137 shared lines) libs/agno/agno/team/_run.py:591 — libs/agno/agno/team/_run.py:591-1079 | libs/agno/agno/team/_run.py:2506-3041 — These two members are variants of one another: 137 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (136 shared lines) · ×2
  • Near-duplicate member pair (136 shared lines) libs/agno/agno/os/routers/agents/schema.py:78 — libs/agno/agno/os/routers/agents/schema.py:78-330 | libs/agno/agno/os/routers/teams/schema.py:78-325 — These two members are variants of one another: 136 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (136 shared lines) libs/agno/agno/db/postgres/postgres.py:4581 — libs/agno/agno/db/postgres/postgres.py:4581-4732 | REDACTED:4422-4574 — These two members are variants of one another: 136 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (110 shared lines) · ×2
  • Near-duplicate member pair (110 shared lines) libs/agno/agno/agent/_storage.py:834 — libs/agno/agno/agent/_storage.py:834-1223 | libs/agno/agno/team/_storage.py:514-878 — These two members are variants of one another: 110 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (110 shared lines) libs/agno/agno/team/_response.py:998 — libs/agno/agno/team/_response.py:998-1145 | libs/agno/agno/team/_response.py:1159-1308 — These two members are variants of one another: 110 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (106 shared lines) · ×2
  • Near-duplicate member pair (106 shared lines) REDACTED:2240 — REDACTED:2240-2414 | REDACTED:2634-3117 — These two members are variants of one another: 106 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (106 shared lines) libs/agno_infra/agno/aws/resource/ec2/security_group.py:331 — libs/agno_infra/agno/aws/resource/ec2/security_group.py:331-463 | libs/agno_infra/agno/aws/resource/ec2/security_group.py:466-588 — These two members are variants of one another: 106 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (92 shared lines) · ×2
  • Near-duplicate member pair (92 shared lines) libs/agno/agno/knowledge/loaders/github.py:343 — libs/agno/agno/knowledge/loaders/github.py:343-493 | libs/agno/agno/knowledge/loaders/github.py:502-652 — These two members are variants of one another: 92 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (92 shared lines) libs/agno/agno/knowledge/knowledge.py:2550 — libs/agno/agno/knowledge/knowledge.py:2550-2731 | libs/agno/agno/knowledge/knowledge.py:2739-2914 — These two members are variants of one another: 92 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (89 shared lines) · ×2
  • Near-duplicate member pair (89 shared lines) libs/agno/agno/agent/_response.py:1371 — libs/agno/agno/agent/_response.py:1371-1713 | libs/agno/agno/team/_response.py:1323-1663 — These two members are variants of one another: 89 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (89 shared lines) libs/agno/agno/learn/stores/session_context.py:899 — libs/agno/agno/learn/stores/session_context.py:899-1030 | libs/agno/agno/learn/stores/session_context.py:1040-1171 — These two members are variants of one another: 89 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (81 shared lines) · ×2
  • Near-duplicate member pair (81 shared lines) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:37 — cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:37-217 | cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:39-191 — These two members are variants of one another: 81 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (81 shared lines) libs/agno/agno/utils/media_offload.py:187 — libs/agno/agno/utils/media_offload.py:187-293 | libs/agno/agno/utils/media_offload.py:399-501 — These two members are variants of one another: 81 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (72 shared lines) · ×2
  • Near-duplicate member pair (72 shared lines) libs/agno/agno/learn/migrations.py:291 — libs/agno/agno/learn/migrations.py:291-451 | libs/agno/agno/learn/migrations.py:460-570 — These two members are variants of one another: 72 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (72 shared lines) libs/agno/agno/db/mysql/mysql.py:2855 — libs/agno/agno/db/mysql/mysql.py:2855-2931 | libs/agno/agno/db/singlestore/singlestore.py:2796-2871 — These two members are variants of one another: 72 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (70 shared lines) · ×2
  • Near-duplicate member pair (70 shared lines) libs/agno/agno/knowledge/knowledge.py:3792 — libs/agno/agno/knowledge/knowledge.py:3792-3896 | libs/agno/agno/knowledge/knowledge.py:3904-4009 — These two members are variants of one another: 70 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (70 shared lines) libs/agno/agno/workflow/workflow.py:5957 — libs/agno/agno/workflow/workflow.py:5957-6072 | libs/agno/agno/workflow/workflow.py:6376-6502 — These two members are variants of one another: 70 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (66 shared lines) · ×2
  • Near-duplicate member pair (66 shared lines) libs/agno/agno/db/postgres/async_postgres.py:2349 — libs/agno/agno/db/postgres/async_postgres.py:2349-2439 | libs/agno/agno/db/postgres/postgres.py:2882-2970 — These two members are variants of one another: 66 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (66 shared lines) libs/agno/agno/memory/strategies/summarize.py:49 — libs/agno/agno/memory/strategies/summarize.py:49-119 | libs/agno/agno/memory/strategies/summarize.py:126-196 — These two members are variants of one another: 66 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (63 shared lines) · ×2
  • Near-duplicate member pair (63 shared lines) libs/agno/agno/knowledge/knowledge.py:2979 — libs/agno/agno/knowledge/knowledge.py:2979-3091 | libs/agno/agno/knowledge/knowledge.py:3102-3203 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (63 shared lines) libs/agno/agno/team/_messages.py:962 — libs/agno/agno/team/_messages.py:962-1076 | libs/agno/agno/team/_messages.py:1097-1210 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (58 shared lines) · ×2
  • Near-duplicate member pair (58 shared lines) REDACTED:1051 — REDACTED:1051-1175 | REDACTED:1319-1478 — These two members are variants of one another: 58 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (58 shared lines) cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:48 — cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:48-132 | cookbook/frameworks/codex/codex_metrics_agentos.py:49-129 — These two members are variants of one another: 58 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (45 shared lines) · ×2
  • Near-duplicate member pair (45 shared lines) libs/agno/agno/db/filter_converter.py:69 — libs/agno/agno/db/filter_converter.py:69-168 | libs/agno/agno/db/valkey/utils.py:252-348 — These two members are variants of one another: 45 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (45 shared lines) libs/agno/agno/utils/print_response/agent.py:453 — libs/agno/agno/utils/print_response/agent.py:453-551 | libs/agno/agno/utils/print_response/agent.py:804-937 — These two members are variants of one another: 45 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (44 shared lines) · ×2
  • Near-duplicate member pair (44 shared lines) libs/agno/agno/db/postgres/async_postgres.py:5164 — libs/agno/agno/db/postgres/async_postgres.py:5164-5240 | libs/agno/agno/db/postgres/postgres.py:7865-7938 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (44 shared lines) libs/agno/agno/run/agent.py:785 — libs/agno/agno/run/agent.py:785-891 | libs/agno/agno/run/team.py:872-961 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×2
  • Edited copy of a member (46 corresponding lines) libs/agno/agno/db/postgres/async_postgres.py:7099 — libs/agno/agno/db/postgres/async_postgres.py:7099-7144 | REDACTED:6268-6313 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) libs/agno/agno/db/postgres/postgres.py:9826 — libs/agno/agno/db/postgres/postgres.py:9826-9871 | REDACTED:8755-8800 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×2
  • Edited copy of a member (18 corresponding lines) libs/agno/agno/db/postgres/async_postgres.py:7149 — libs/agno/agno/db/postgres/async_postgres.py:7149-7166 | REDACTED:6318-6335 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) libs/agno/agno/db/postgres/postgres.py:9876 — libs/agno/agno/db/postgres/postgres.py:9876-9893 | REDACTED:8805-8822 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×2
  • Edited copy of a member (15 corresponding lines) libs/agno/agno/models/huggingface/huggingface.py:248 — libs/agno/agno/models/huggingface/huggingface.py:248-267 | libs/agno/agno/models/huggingface/huggingface.py:279-298 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) libs/agno_infra/agno/docker/app/base.py:132 — libs/agno_infra/agno/docker/app/base.py:132-181 | libs/agno_infra/agno/docker/app/postgres/postgres.py:63-108 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (18 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (18 members, 50+ identical tokens) libs/agno/agno/reasoning/anthropic.py:75 — libs/agno/agno/reasoning/anthropic.py:75-104 | libs/agno/agno/reasoning/anthropic.py:154-183 | libs/agno/agno/reasoning/azure_ai_foundry.py:24-50 | libs/agno/agno/reasoning/azure_ai_foundry.py:58-83 | libs/agno/agno/reasoning/deepseek.py:38-63 | libs/agno/agno/reasoning/deepseek.py:117-142 | libs/agno/agno/reasoning/gemini.py:62-84 | libs/agno/agno/reasoning/gemini.py:92-114 | libs/agno/agno/reasoning/groq.py:27-56 | libs/agno/agno/reasoning/groq.py:65-94 | libs/agno/agno/reasoning/moonshot.py:75-101 | libs/agno/agno/reasoning/moonshot.py:110-135 | libs/agno/agno/reasoning/ollama.py:81-107 | libs/agno/agno/reasoning/ollama.py:115-140 | libs/agno/agno/reasoning/openai.py:49-79 | libs/agno/agno/reasoning/openai.py:88-117 | libs/agno/agno/reasoning/vertexai.py:29-58 | libs/agno/agno/reasoning/vertexai.py:66-95 — These 18 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 18 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 18 times.
  • Members sharing a duplicated core (18 members, 50+ identical tokens) libs/agno/agno/reasoning/anthropic.py:111 — libs/agno/agno/reasoning/anthropic.py:111-146 | libs/agno/agno/reasoning/anthropic.py:190-225 | libs/agno/agno/reasoning/azure_ai_foundry.py:90-129 | libs/agno/agno/reasoning/azure_ai_foundry.py:136-175 | libs/agno/agno/reasoning/deepseek.py:70-108 | libs/agno/agno/reasoning/deepseek.py:149-187 | libs/agno/agno/reasoning/gemini.py:121-154 | libs/agno/agno/reasoning/gemini.py:161-194 | libs/agno/agno/reasoning/groq.py:101-145 | libs/agno/agno/reasoning/groq.py:152-196 | libs/agno/agno/reasoning/moonshot.py:142-180 | libs/agno/agno/reasoning/moonshot.py:187-225 | libs/agno/agno/reasoning/ollama.py:147-186 | libs/agno/agno/reasoning/ollama.py:193-232 | libs/agno/agno/reasoning/openai.py:124-173 | libs/agno/agno/reasoning/openai.py:180-229 | libs/agno/agno/reasoning/vertexai.py:102-137 | libs/agno/agno/reasoning/vertexai.py:144-179 — These 18 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 18 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 18 times.
D4 · Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (11 members, 50+ identical tokens) libs/agno/agno/db/mysql/async_mysql.py:3034 — libs/agno/agno/db/mysql/async_mysql.py:3034-3110 | libs/agno/agno/db/mysql/mysql.py:3000-3074 | libs/agno/agno/db/postgres/async_postgres.py:3418-3505 | libs/agno/agno/db/postgres/async_postgres.py:3841-3970 | libs/agno/agno/db/postgres/postgres.py:3961-4046 | libs/agno/agno/db/postgres/postgres.py:4380-4508 | libs/agno/agno/db/singlestore/singlestore.py:2940-3014 | REDACTED:3564-3650 | REDACTED:3972-4101 | REDACTED:3758-3849 | REDACTED:4166-4296 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
  • Members sharing a duplicated core (11 members, 50+ identical tokens) libs/agno/agno/models/dashscope/dashscope.py:43 — libs/agno/agno/models/dashscope/dashscope.py:43-68 | libs/agno/agno/models/deepseek/deepseek.py:113-139 | libs/agno/agno/models/groq/groq.py:73-95 | libs/agno/agno/models/minimax/minimax.py:38-63 | libs/agno/agno/models/moonshot/moonshot.py:105-131 | libs/agno/agno/models/n1n/n1n.py:31-57 | libs/agno/agno/models/nebius/nebius.py:30-53 | libs/agno/agno/models/openai/chat.py:107-132 | libs/agno/agno/models/openai/responses.py:197-232 | libs/agno/agno/models/synthorai/synthorai.py:31-57 | libs/agno/agno/models/trustedrouter/trustedrouter.py:30-53 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (9 members, 50+ identical tokens) cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:95 — cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:95-106 | cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:221-234 | cookbook/07_knowledge/09_archive/vector_dbs/lance_db.py:60-73 | cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py:70-81 | cookbook/07_knowledge/09_archive/vector_dbs/pgvector_db.py:66-77 | cookbook/07_knowledge/09_archive/vector_dbs/pinecone_db.py:75-86 | cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py:78-91 | cookbook/07_knowledge/09_archive/vector_dbs/singlestore_db.py:86-97 | cookbook/07_knowledge/09_archive/vector_dbs/upstash_db.py:69-80 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
  • Members sharing a duplicated core (9 members, 50+ identical tokens) libs/agno/agno/db/mongo/async_mongo.py:907 — libs/agno/agno/db/mongo/async_mongo.py:907-967 | libs/agno/agno/db/mongo/mongo.py:717-777 | libs/agno/agno/db/mysql/async_mysql.py:946-1030 | libs/agno/agno/db/mysql/mysql.py:942-1023 | libs/agno/agno/db/postgres/async_postgres.py:1520-1610 | libs/agno/agno/db/postgres/postgres.py:1754-1841 | libs/agno/agno/db/singlestore/singlestore.py:997-1078 | REDACTED:1446-1540 | REDACTED:1708-1797 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication · Duplicated block (81 lines × 2) · ×2
  • Duplicated block (81 lines × 2) libs/agno/agno/team/_messages.py:1227 — libs/agno/agno/team/_messages.py:1227-1307 | libs/agno/agno/team/_messages.py:1386-1466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (81 lines × 2) libs/agno/agno/utils/print_response/workflow.py:249 — libs/agno/agno/utils/print_response/workflow.py:249-329 | libs/agno/agno/utils/print_response/workflow.py:1110-1190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (80 lines × 2) · ×2
  • Duplicated block (80 lines × 2) libs/agno/agno/db/postgres/postgres.py:5962 — libs/agno/agno/db/postgres/postgres.py:5962-6041 | REDACTED:5752-5831 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5962` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (80 lines × 2) libs/agno/agno/workflow/loop.py:743 — libs/agno/agno/workflow/loop.py:743-822 | libs/agno/agno/workflow/loop.py:1140-1219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:743` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (74 lines × 2) · ×2
  • Duplicated block (74 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:340 — libs/agno/agno/db/mysql/async_mysql.py:340-413 | libs/agno/agno/db/postgres/async_postgres.py:511-584 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (74 lines × 2) libs/agno/agno/os/routers/agents/router.py:1078 — libs/agno/agno/os/routers/agents/router.py:1078-1151 | libs/agno/agno/os/routers/teams/router.py:981-1054 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1078` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (69 lines × 2) · ×2
  • Duplicated block (69 lines × 2) libs/agno/agno/agent/_run.py:412 — libs/agno/agno/agent/_run.py:412-480 | libs/agno/agno/agent/_run.py:820-888 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:412` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (69 lines × 2) libs/agno/agno/utils/print_response/team.py:535 — libs/agno/agno/utils/print_response/team.py:535-603 | libs/agno/agno/utils/print_response/team.py:1466-1534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (66 lines × 2) · ×2
  • Duplicated block (66 lines × 2) libs/agno/agno/utils/print_response/workflow.py:127 — libs/agno/agno/utils/print_response/workflow.py:127-192 | libs/agno/agno/utils/print_response/workflow.py:988-1053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/workflow.py:127` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (66 lines × 2) libs/agno/agno/workflow/workflow.py:6790 — libs/agno/agno/workflow/workflow.py:6790-6855 | libs/agno/agno/workflow/workflow.py:8820-8885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:6790` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (64–65 lines × 2) · ×2
  • Duplicated block (64–65 lines × 2) libs/agno/agno/db/postgres/postgres.py:4961 — libs/agno/agno/db/postgres/postgres.py:4961-5025 | REDACTED:4802-4865 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:4961` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (64–65 lines × 2) libs/agno/agno/utils/print_response/workflow.py:780 — libs/agno/agno/utils/print_response/workflow.py:780-844 | libs/agno/agno/utils/print_response/workflow.py:1645-1708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/workflow.py:780` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (60 lines × 2) · ×2
  • Duplicated block (60 lines × 2) libs/agno/agno/agent/_messages.py:1631 — libs/agno/agno/agent/_messages.py:1631-1690 | libs/agno/agno/agent/_messages.py:1801-1860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1631` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (60 lines × 2) libs/agno/agno/workflow/loop.py:682 — libs/agno/agno/workflow/loop.py:682-741 | libs/agno/agno/workflow/loop.py:1079-1138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:682` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (56–57 lines × 2) · ×2
  • Duplicated block (56–57 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:2761 — libs/agno/agno/db/postgres/async_postgres.py:2761-2817 | libs/agno/agno/db/postgres/postgres.py:3306-3361 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:2761` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (56–57 lines × 2) libs/agno/agno/workflow/steps.py:492 — libs/agno/agno/workflow/steps.py:492-548 | libs/agno/agno/workflow/steps.py:797-852 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/steps.py:492` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (51 lines × 2) · ×2
  • Duplicated block (51 lines × 2) libs/agno/agno/db/postgres/postgres.py:6421 — libs/agno/agno/db/postgres/postgres.py:6421-6471 | REDACTED:6205-6255 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (51 lines × 2) libs/agno/agno/db/redis/redis.py:805 — libs/agno/agno/db/redis/redis.py:805-855 | libs/agno/agno/db/valkey/valkey.py:935-985 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (49 lines × 4) · ×2
  • Duplicated block (49 lines × 4) libs/agno/agno/models/openai/chat.py:433 — libs/agno/agno/models/openai/chat.py:433-481 | libs/agno/agno/models/openai/chat.py:523-571 | libs/agno/agno/models/openai/chat.py:610-658 | libs/agno/agno/models/openai/chat.py:699-747 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (49 lines × 4) libs/agno/agno/models/openai/responses.py:935 — libs/agno/agno/models/openai/responses.py:935-983 | libs/agno/agno/models/openai/responses.py:1056-1104 | libs/agno/agno/models/openai/responses.py:1165-1213 | libs/agno/agno/models/openai/responses.py:1269-1317 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (49 lines × 2) · ×2
  • Duplicated block (49 lines × 2) libs/agno/agno/db/mysql/mysql.py:484 — libs/agno/agno/db/mysql/mysql.py:484-532 | libs/agno/agno/db/postgres/postgres.py:939-987 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (49 lines × 2) libs/agno/agno/os/interfaces/a2a/router.py:153 — libs/agno/agno/os/interfaces/a2a/router.py:153-201 | libs/agno/agno/os/interfaces/a2a/router.py:484-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:153` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (45–47 lines × 2) · ×2
  • Duplicated block (45–47 lines × 2) libs/agno/agno/team/_run.py:2896 — libs/agno/agno/team/_run.py:2896-2940 | libs/agno/agno/team/_run.py:3960-4006 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:3960` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (45–47 lines × 2) libs/agno/agno/team/_run.py:5547 — libs/agno/agno/team/_run.py:5547-5591 | libs/agno/agno/team/_run.py:5636-5682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:5547` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×2
  • Duplicated block (46 lines × 2) REDACTED:330 — REDACTED:330-375 | REDACTED:691-736 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:377` calls `embed` and `REDACTED:738` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (46 lines × 2) libs/agno/agno/workflow/condition.py:681 — libs/agno/agno/workflow/condition.py:681-726 | libs/agno/agno/workflow/condition.py:1134-1179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:681` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (43–45 lines × 2) · ×2
  • Duplicated block (43–45 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:420 — libs/agno/agno/db/mysql/async_mysql.py:420-462 | libs/agno/agno/db/postgres/async_postgres.py:698-742 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (43–45 lines × 2) libs/agno/agno/workflow/workflow.py:6735 — libs/agno/agno/workflow/workflow.py:6735-6779 | libs/agno/agno/workflow/workflow.py:8767-8809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:6735` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (43 lines × 3) · ×2
  • Duplicated block (43 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1423 — libs/agno/agno/db/mysql/async_mysql.py:1423-1465 | libs/agno/agno/db/mysql/mysql.py:1406-1448 | libs/agno/agno/db/singlestore/singlestore.py:1457-1499 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (43 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1474 — libs/agno/agno/db/mysql/async_mysql.py:1474-1516 | libs/agno/agno/db/mysql/mysql.py:1456-1498 | libs/agno/agno/db/singlestore/singlestore.py:1507-1549 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (41–43 lines × 2) · ×2
  • Duplicated block (41–43 lines × 2) cookbook/performance/comparison/run_all.py:133 — cookbook/performance/comparison/run_all.py:133-173 | cookbook/performance/run_all.py:63-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (41–43 lines × 2) libs/agno/agno/db/redis/redis.py:1465 — libs/agno/agno/db/redis/redis.py:1465-1505 | libs/agno/agno/db/valkey/valkey.py:1838-1880 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:1465` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (42–43 lines × 2) · ×2
  • Duplicated block (42–43 lines × 2) libs/agno/agno/models/deepseek/deepseek.py:142 — libs/agno/agno/models/deepseek/deepseek.py:142-184 | libs/agno/agno/models/openai/chat.py:315-356 — before extracting anything, compare `libs/agno/agno/models/deepseek/deepseek.py` and `libs/agno/agno/models/openai/chat.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (42–43 lines × 2) libs/agno/agno/workflow/loop.py:536 — libs/agno/agno/workflow/loop.py:536-578 | libs/agno/agno/workflow/loop.py:934-975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/loop.py:536` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (41–42 lines × 2) · ×2
  • Duplicated block (41–42 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:233 — libs/agno/agno/db/gcs_json/gcs_json_db.py:233-273 | libs/agno/agno/db/json/json_db.py:258-299 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (41–42 lines × 2) libs/agno/agno/utils/pprint.py:25 — libs/agno/agno/utils/pprint.py:25-66 | libs/agno/agno/utils/pprint.py:109-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (38–39 lines × 2) · ×2
  • Duplicated block (38–39 lines × 2) libs/agno/agno/agent/_messages.py:843 — libs/agno/agno/agent/_messages.py:843-881 | libs/agno/agno/team/_messages.py:1614-1651 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (38–39 lines × 2) libs/agno/agno/agent/_run.py:1718 — libs/agno/agno/agent/_run.py:1718-1756 | libs/agno/agno/agent/_run.py:4960-4997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1718` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (33–37 lines × 2) · ×2
  • Duplicated block (33–37 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:795 — libs/agno/agno/db/mysql/async_mysql.py:795-827 | REDACTED:1093-1129 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (33–37 lines × 2) REDACTED:545 — REDACTED:545-581 | REDACTED:1294-1326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–37 lines × 2) · ×2
  • Duplicated block (32–37 lines × 2) libs/agno/agno/learn/stores/entity_memory.py:1329 — libs/agno/agno/learn/stores/entity_memory.py:1329-1365 | libs/agno/agno/learn/stores/entity_memory.py:1379-1410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (32–37 lines × 2) libs/agno_infra/agno/aws/resource/ecs/service.py:122 — libs/agno_infra/agno/aws/resource/ecs/service.py:122-153 | libs/agno_infra/agno/aws/resource/ecs/service.py:336-372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (34 lines × 4) · ×2
  • Duplicated block (34 lines × 4) libs/agno/agno/agent/_messages.py:1932 — libs/agno/agno/agent/_messages.py:1932-1965 | libs/agno/agno/agent/_messages.py:2147-2180 | libs/agno/agno/team/_messages.py:989-1022 | libs/agno/agno/team/_messages.py:1124-1157 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1932` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_messages.py:988` calls `_input_kwarg` and `libs/agno/agno/agent/_messages.py:1931` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (34 lines × 4) REDACTED:410 — REDACTED:410-443 | REDACTED:509-542 | REDACTED:611-644 | REDACTED:715-748 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:409` calls `embed` and `REDACTED:508` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (33–34 lines × 4) · ×2
  • Duplicated block (33–34 lines × 4) libs/agno/agno/db/mysql/mysql.py:1772 — libs/agno/agno/db/mysql/mysql.py:1772-1804 | libs/agno/agno/db/postgres/postgres.py:2650-2683 | libs/agno/agno/db/singlestore/singlestore.py:1797-1830 | REDACTED:2557-2590 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (33–34 lines × 4) libs/agno/agno/db/mysql/utils.py:24 — libs/agno/agno/db/mysql/utils.py:24-57 | libs/agno/agno/db/postgres/utils.py:33-66 | libs/agno/agno/db/singlestore/utils.py:25-58 | libs/agno/agno/db/sqlite/utils.py:27-59 — `libs/agno/agno/db/mysql/utils.py` and `libs/agno/agno/db/postgres/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 14 separate duplicated blocks between them, totalling at least 283 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/utils.py:26` calls `is_foreign_key_violation`, `getattr` and `libs/agno/agno/db/mysql/utils.py:19` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (31–34 lines × 3) · ×2
  • Duplicated block (31–34 lines × 3) libs/agno/agno/agent/_run.py:3430 — libs/agno/agno/agent/_run.py:3430-3463 | libs/agno/agno/agent/_run.py:4775-4805 | libs/agno/agno/agent/_run.py:5291-5323 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:3430` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (31–34 lines × 3) REDACTED:217 — REDACTED:217-247 | REDACTED:313-346 | REDACTED:412-444 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–34 lines × 2) · ×2
  • Duplicated block (32–34 lines × 2) libs/agno/agno/db/mysql/utils.py:95 — libs/agno/agno/db/mysql/utils.py:95-128 | libs/agno/agno/db/postgres/utils.py:135-166 — `libs/agno/agno/db/mysql/utils.py` and `libs/agno/agno/db/postgres/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 14 separate duplicated blocks between them, totalling at least 283 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (32–34 lines × 2) libs/agno/agno/tools/knowledge/knowledge.py:60 — libs/agno/agno/tools/knowledge/knowledge.py:60-93 | libs/agno/agno/tools/knowledge/knowledge.py:118-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29–33 lines × 4) · ×2
  • Duplicated block (29–33 lines × 4) libs/agno/agno/agent/_hooks.py:62 — libs/agno/agno/agent/_hooks.py:62-94 | libs/agno/agno/agent/_hooks.py:281-309 | libs/agno/agno/team/_hooks.py:261-290 | libs/agno/agno/team/_hooks.py:461-489 — `libs/agno/agno/agent/_hooks.py` and `libs/agno/agno/team/_hooks.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 106 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (29–33 lines × 4) libs/agno/agno/team/_run.py:425 — libs/agno/agno/team/_run.py:425-455 | libs/agno/agno/team/_run.py:872-904 | libs/agno/agno/team/_run.py:2322-2350 | libs/agno/agno/team/_run.py:2805-2835 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:872` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–33 lines × 2) · ×2
  • Duplicated block (32–33 lines × 2) libs/agno/agno/company/routines.py:585 — libs/agno/agno/company/routines.py:585-616 | libs/agno/agno/scheduler/executor.py:296-328 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/company/routines.py:585` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (32–33 lines × 2) libs/agno/agno/team/_run.py:1683 — libs/agno/agno/team/_run.py:1683-1714 | libs/agno/agno/team/_run.py:8468-8500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31 lines × 4) · ×2
  • Duplicated block (31 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:5807 — libs/agno/agno/db/postgres/async_postgres.py:5807-5837 | libs/agno/agno/db/postgres/postgres.py:8478-8508 | REDACTED:4974-5004 | REDACTED:7410-7440 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (31 lines × 4) libs/agno/agno/workflow/workflow.py:3646 — libs/agno/agno/workflow/workflow.py:3646-3676 | libs/agno/agno/workflow/workflow.py:4691-4721 | libs/agno/agno/workflow/workflow.py:8475-8505 | libs/agno/agno/workflow/workflow.py:10235-10265 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3646` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28–31 lines × 2) · ×2
  • Duplicated block (28–31 lines × 2) libs/agno/agno/eval/performance.py:421 — libs/agno/agno/eval/performance.py:421-451 | libs/agno/agno/eval/performance.py:468-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (28–31 lines × 2) libs/agno/agno/tools/gitlab.py:378 — libs/agno/agno/tools/gitlab.py:378-405 | libs/agno/agno/tools/gitlab.py:533-563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (28–29 lines × 3) · ×2
  • Duplicated block (28–29 lines × 3) libs/agno/agno/db/dynamo/utils.py:426 — libs/agno/agno/db/dynamo/utils.py:426-453 | libs/agno/agno/db/redis/utils.py:268-296 | libs/agno/agno/db/valkey/utils.py:463-491 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/redis/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 169 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (28–29 lines × 3) libs/agno_infra/agno/infra/operator.py:233 — libs/agno_infra/agno/infra/operator.py:233-261 | libs/agno_infra/agno/infra/operator.py:305-333 | libs/agno_infra/agno/infra/operator.py:378-405 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25–29 lines × 2) · ×2
  • Duplicated block (25–29 lines × 2) libs/agno/agno/os/routers/agents/router.py:933 — libs/agno/agno/os/routers/agents/router.py:933-957 | libs/agno/agno/os/routers/agents/router.py:1056-1084 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (25–29 lines × 2) libs/agno/agno/os/routers/teams/router.py:840 — libs/agno/agno/os/routers/teams/router.py:840-864 | libs/agno/agno/os/routers/teams/router.py:959-987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (27–28 lines × 4) · ×2
  • Duplicated block (27–28 lines × 4) libs/agno/agno/db/firestore/firestore.py:1394 — libs/agno/agno/db/firestore/firestore.py:1394-1421 | libs/agno/agno/db/gcs_json/gcs_json_db.py:981-1007 | libs/agno/agno/db/in_memory/in_memory_db.py:822-848 | libs/agno/agno/db/json/json_db.py:1048-1074 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (27–28 lines × 4) libs/agno/agno/team/_hooks.py:253 — libs/agno/agno/team/_hooks.py:253-280 | libs/agno/agno/team/_hooks.py:351-377 | libs/agno/agno/team/_hooks.py:453-479 | libs/agno/agno/team/_hooks.py:548-574 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_hooks.py:378` calls `iscoroutinefunction`, `hook` and `libs/agno/agno/team/_hooks.py:281` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (28 lines × 4) · ×2
  • Duplicated block (28 lines × 4) libs/agno/agno/db/mysql/mysql.py:2216 — libs/agno/agno/db/mysql/mysql.py:2216-2243 | libs/agno/agno/db/postgres/postgres.py:3125-3152 | libs/agno/agno/db/singlestore/singlestore.py:2243-2270 | REDACTED:3042-3069 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (28 lines × 4) libs/agno/agno/knowledge/knowledge.py:5503 — libs/agno/agno/knowledge/knowledge.py:5503-5530 | libs/agno/agno/knowledge/knowledge.py:5546-5573 | libs/agno/agno/knowledge/knowledge.py:5639-5666 | libs/agno/agno/knowledge/knowledge.py:5704-5731 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/knowledge.py:5503` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25–28 lines × 2) · ×2
  • Duplicated block (25–28 lines × 2) libs/agno/agno/agent/_storage.py:1644 — libs/agno/agno/agent/_storage.py:1644-1671 | libs/agno/agno/team/_storage.py:1629-1653 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25–28 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1335 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1335-1359 | libs/agno/agno/db/json/json_db.py:1414-1441 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21–28 lines × 2) · ×2
  • Duplicated block (21–28 lines × 2) libs/agno/agno/models/openai/chat.py:809 — libs/agno/agno/models/openai/chat.py:809-829 | libs/agno/agno/models/perplexity/perplexity.py:103-130 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `ChatCompletion` in one and `Union[ChatCompletion, ParsedChatCompletion]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (21–28 lines × 2) libs/agno/agno/workflow/workflow.py:5223 — libs/agno/agno/workflow/workflow.py:5223-5250 | libs/agno/agno/workflow/workflow.py:5490-5510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23–28 lines × 2) · ×2
  • Duplicated block (23–28 lines × 2) libs/agno/agno/team/_session.py:354 — libs/agno/agno/team/_session.py:354-381 | libs/agno/agno/team/_session.py:401-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_session.py:425` calls `_has_async_db`, `_aupsert_session` and `libs/agno/agno/team/_session.py:382` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (23–28 lines × 2) libs/agno_infra/agno/aws/resource/cloudformation/stack.py:167 — libs/agno_infra/agno/aws/resource/cloudformation/stack.py:167-194 | libs/agno_infra/agno/aws/resource/cloudformation/stack.py:197-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–27 lines × 2) · ×2
  • Duplicated block (23–27 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2709 — libs/agno/agno/db/mysql/async_mysql.py:2709-2731 | REDACTED:3230-3256 — `libs/agno/agno/db/mysql/async_mysql.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1739 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3261` calls `log_debug` and `libs/agno/agno/db/mysql/async_mysql.py:2735` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (23–27 lines × 2) libs/agno/agno/tools/coding.py:681 — libs/agno/agno/tools/coding.py:681-707 | libs/agno/agno/tools/coding.py:763-785 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23–26 lines × 2) · ×2
  • Duplicated block (23–26 lines × 2) libs/agno/agno/agent/_tools.py:668 — libs/agno/agno/agent/_tools.py:668-693 | libs/agno/agno/team/_tools.py:488-510 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:668` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–26 lines × 2) libs/agno/agno/os/routers/agents/router.py:708 — libs/agno/agno/os/routers/agents/router.py:708-733 | libs/agno/agno/os/routers/teams/router.py:623-645 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:708` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–26 lines × 2) · ×2
  • Duplicated block (21–26 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:1661 — libs/agno/agno/db/dynamo/dynamo.py:1661-1686 | REDACTED:2964-2984 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/dynamo/dynamo.py:1661` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21–26 lines × 2) REDACTED:461 — REDACTED:461-481 | REDACTED:662-687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23–25 lines × 4) · ×2
  • Duplicated block (23–25 lines × 4) libs/agno/agno/reasoning/deepseek.py:70 — libs/agno/agno/reasoning/deepseek.py:70-92 | libs/agno/agno/reasoning/groq.py:101-125 | libs/agno/agno/reasoning/moonshot.py:142-164 | libs/agno/agno/reasoning/openai.py:124-148 — before extracting anything, compare `libs/agno/agno/reasoning/deepseek.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 155 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (23–25 lines × 4) libs/agno/agno/reasoning/deepseek.py:149 — libs/agno/agno/reasoning/deepseek.py:149-171 | libs/agno/agno/reasoning/groq.py:152-176 | libs/agno/agno/reasoning/moonshot.py:187-209 | libs/agno/agno/reasoning/openai.py:180-204 — before extracting anything, compare `libs/agno/agno/reasoning/deepseek.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 155 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (24 lines × 4) · ×2
  • Duplicated block (24 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3896 — libs/agno/agno/db/postgres/async_postgres.py:3896-3919 | libs/agno/agno/db/postgres/postgres.py:4435-4458 | REDACTED:4030-4053 | REDACTED:4224-4247 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (24 lines × 4) libs/agno/agno/workflow/condition.py:823 — libs/agno/agno/workflow/condition.py:823-846 | libs/agno/agno/workflow/condition.py:1277-1300 | libs/agno/agno/workflow/router.py:852-875 | libs/agno/agno/workflow/router.py:1193-1216 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:823` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×2
  • Duplicated block (21–24 lines × 2) libs/agno/agno/tools/whatsapp.py:224 — libs/agno/agno/tools/whatsapp.py:224-244 | libs/agno/agno/tools/whatsapp.py:296-319 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21–24 lines × 2) libs/agno/agno/workflow/step.py:1167 — libs/agno/agno/workflow/step.py:1167-1190 | libs/agno/agno/workflow/step.py:1876-1896 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `Team` names `agno.team` in one and `agno.team.team` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (20–23 lines × 2) · ×2
  • Duplicated block (20–23 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1670 — libs/agno/agno/db/mongo/async_mongo.py:1670-1692 | libs/agno/agno/db/mongo/async_mongo.py:3826-3845 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1670` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–23 lines × 2) libs/agno/agno/os/routers/traces/traces.py:162 — libs/agno/agno/os/routers/traces/traces.py:162-184 | libs/agno/agno/os/routers/traces/traces.py:540-559 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/traces/traces.py:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–23 lines × 2) · ×2
  • Duplicated block (19–23 lines × 2) libs/agno/agno/os/utils.py:2468 — libs/agno/agno/os/utils.py:2468-2490 | libs/agno/agno/os/utils.py:2503-2521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/utils.py:2491` calls `getattr`, `add_db` and `libs/agno/agno/os/utils.py:2522` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19–23 lines × 2) REDACTED:2166 — REDACTED:2166-2184 | REDACTED:2168-2190 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21–22 lines × 4) · ×2
  • Duplicated block (21–22 lines × 4) libs/agno/agno/db/gcs_json/gcs_json_db.py:1873 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1873-1894 | libs/agno/agno/db/json/json_db.py:1970-1991 | libs/agno/agno/db/redis/redis.py:2261-2281 | libs/agno/agno/db/valkey/valkey.py:2754-2774 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/valkey/valkey.py:2775` calls `record_matches_filter_expr` and `libs/agno/agno/db/gcs_json/gcs_json_db.py:1896` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (21–22 lines × 4) libs/agno/agno/utils/print_response/team.py:641 — libs/agno/agno/utils/print_response/team.py:641-662 | libs/agno/agno/utils/print_response/team.py:878-898 | libs/agno/agno/utils/print_response/team.py:1572-1593 | libs/agno/agno/utils/print_response/team.py:1827-1847 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (19–22 lines × 3) · ×2
  • Duplicated block (19–22 lines × 3) libs/agno/agno/os/routers/teams/router.py:238 — libs/agno/agno/os/routers/teams/router.py:238-256 | libs/agno/agno/os/routers/teams/router.py:481-502 | libs/agno/agno/os/routers/teams/router.py:548-566 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–22 lines × 3) libs/agno/agno/workflow/workflow.py:5066 — libs/agno/agno/workflow/workflow.py:5066-5084 | libs/agno/agno/workflow/workflow.py:5306-5325 | libs/agno/agno/workflow/workflow.py:5554-5575 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:5554` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–22 lines × 2) · ×2
  • Duplicated block (13–22 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1458 — libs/agno/agno/db/mongo/async_mongo.py:1458-1479 | libs/agno/agno/db/mongo/async_mongo.py:2276-2288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mongo/async_mongo.py:2290` calls `log_debug` and `libs/agno/agno/db/mongo/async_mongo.py:1481` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–22 lines × 2) libs/agno/agno/db/mongo/mongo.py:1268 — libs/agno/agno/db/mongo/mongo.py:1268-1289 | libs/agno/agno/db/mongo/mongo.py:2081-2093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mongo/mongo.py:2095` calls `log_debug` and `libs/agno/agno/db/mongo/mongo.py:1291` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–22 lines × 2) · ×2
  • Duplicated block (16–22 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:1012 — libs/agno/agno/db/postgres/async_postgres.py:1012-1033 | libs/agno/agno/db/postgres/async_postgres.py:4966-4981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–22 lines × 2) libs/agno/agno/os/routers/agents/router.py:356 — libs/agno/agno/os/routers/agents/router.py:356-377 | libs/agno/agno/os/routers/teams/router.py:461-476 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:356` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–22 lines × 2) · ×2
  • Duplicated block (18–22 lines × 2) libs/agno/agno/media/media.py:81 — libs/agno/agno/media/media.py:81-102 | libs/agno/agno/media/media.py:135-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–22 lines × 2) libs/agno/agno/tools/studio.py:3020 — libs/agno/agno/tools/studio.py:3020-3041 | libs/agno/agno/tools/studio.py:3149-3166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio.py:3020` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–21 lines × 3) · ×2
  • Duplicated block (20–21 lines × 3) libs/agno/agno/agent/_run.py:198 — libs/agno/agno/agent/_run.py:198-217 | libs/agno/agno/team/_run.py:5203-5223 | libs/agno/agno/team/_run.py:5235-5255 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:5259` calls `iscoroutine` and `libs/agno/agno/team/_run.py:5227` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (20–21 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2516 — libs/agno/agno/db/mysql/async_mysql.py:2516-2536 | libs/agno/agno/db/postgres/async_postgres.py:2888-2908 | REDACTED:3039-3058 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×2
  • Duplicated block (19–21 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:6036 — libs/agno/agno/db/postgres/async_postgres.py:6036-6054 | REDACTED:5203-5223 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–21 lines × 2) libs/agno/agno/run/agent.py:997 — libs/agno/agno/run/agent.py:997-1015 | libs/agno/agno/run/team.py:1053-1073 — before extracting anything, compare `libs/agno/agno/run/agent.py` and `libs/agno/agno/run/team.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 181 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/run/agent.py:997` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×2
  • Duplicated block (18–21 lines × 2) libs/agno/agno/knowledge/loaders/sharepoint.py:50 — libs/agno/agno/knowledge/loaders/sharepoint.py:50-70 | libs/agno/agno/knowledge/remote_content/sharepoint.py:59-76 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (18–21 lines × 2) libs/agno/agno/team/_run.py:2056 — libs/agno/agno/team/_run.py:2056-2073 | libs/agno/agno/team/_run.py:4249-4269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:4249` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:2053` calls `_resolve_run_dependencies` and `libs/agno/agno/team/_run.py:4249` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18–20 lines × 3) · ×2
  • Duplicated block (18–20 lines × 3) libs/agno/agno/reasoning/azure_ai_foundry.py:90 — libs/agno/agno/reasoning/azure_ai_foundry.py:90-109 | libs/agno/agno/reasoning/gemini.py:121-138 | libs/agno/agno/reasoning/ollama.py:147-166 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/gemini.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18–20 lines × 3) libs/agno/agno/reasoning/azure_ai_foundry.py:136 — libs/agno/agno/reasoning/azure_ai_foundry.py:136-155 | libs/agno/agno/reasoning/gemini.py:161-178 | libs/agno/agno/reasoning/ollama.py:193-212 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/gemini.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19 lines × 5) · ×2
  • Duplicated block (19 lines × 5) libs/agno/agno/db/firestore/firestore.py:2276 — libs/agno/agno/db/firestore/firestore.py:2276-2294 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1650-1668 | libs/agno/agno/db/json/json_db.py:1754-1772 | libs/agno/agno/db/redis/redis.py:2018-2036 | libs/agno/agno/db/valkey/valkey.py:2452-2470 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `agent_id` to `Any` in one and `Optional[str]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (19 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:1011 — libs/agno/agno/db/mysql/async_mysql.py:1011-1029 | libs/agno/agno/db/mysql/mysql.py:1004-1022 | libs/agno/agno/db/postgres/async_postgres.py:1591-1609 | libs/agno/agno/db/postgres/postgres.py:1822-1840 | libs/agno/agno/db/singlestore/singlestore.py:1059-1077 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–19 lines × 4) · ×2
  • Duplicated block (18–19 lines × 4) libs/agno/agno/utils/print_response/agent.py:580 — libs/agno/agno/utils/print_response/agent.py:580-597 | libs/agno/agno/utils/print_response/agent.py:700-717 | libs/agno/agno/utils/print_response/team.py:63-81 | libs/agno/agno/utils/print_response/team.py:998-1016 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18–19 lines × 4) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:345 — libs/agno_infra/agno/aws/resource/rds/db_cluster.py:345-362 | libs/agno_infra/agno/aws/resource/rds/db_cluster.py:630-648 | libs/agno_infra/agno/aws/resource/rds/db_instance.py:267-284 | libs/agno_infra/agno/aws/resource/rds/db_instance.py:545-563 — before extracting anything, compare `libs/agno_infra/agno/aws/resource/rds/db_cluster.py` and `libs/agno_infra/agno/aws/resource/rds/db_instance.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–19 lines × 3) · ×2
  • Duplicated block (17–19 lines × 3) libs/agno/agno/team/_run.py:7687 — libs/agno/agno/team/_run.py:7687-7703 | libs/agno/agno/team/_run.py:9512-9530 | libs/agno/agno/team/_run.py:9985-10003 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17–19 lines × 3) libs/agno/agno/workflow/step.py:1190 — libs/agno/agno/workflow/step.py:1190-1208 | libs/agno/agno/workflow/step.py:1543-1559 | libs/agno/agno/workflow/step.py:1903-1920 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/step.py:1560` calls `log_debug` and `libs/agno/agno/workflow/step.py:1209` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–18 lines × 2) · ×2
  • Duplicated block (13–18 lines × 2) libs/agno/agno/db/mysql/mysql.py:1186 — libs/agno/agno/db/mysql/mysql.py:1186-1198 | libs/agno/agno/db/postgres/postgres.py:2015-2032 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:2015` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:2034` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:1200` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–18 lines × 2) libs/agno/agno/models/ollama/chat.py:380 — libs/agno/agno/models/ollama/chat.py:380-397 | libs/agno/agno/models/ollama/chat.py:421-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `dict` in one and `ChatResponse` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) libs/agno/agno/knowledge/knowledge.py:3430 — libs/agno/agno/knowledge/knowledge.py:3430-3447 | libs/agno/agno/knowledge/knowledge.py:3629-3644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–18 lines × 2) libs/agno/agno/os/routers/teams/router.py:883 — libs/agno/agno/os/routers/teams/router.py:883-898 | libs/agno/agno/os/routers/workflows/router.py:1991-2008 — `libs/agno/agno/os/routers/teams/router.py` and `libs/agno/agno/os/routers/workflows/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 15 separate duplicated blocks between them, totalling at least 391 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/teams/router.py:883` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17 lines × 8) · ×2
  • Duplicated block (17 lines × 8) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:96 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:96-112 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/02_step_user_input_and_tool_confirmation.py:107-123 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:126-142 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/04_router_selection_and_tool_confirmation.py:133-149 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:90-106 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:109-125 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:126-142 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:216-232 — before extracting anything, compare `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py` and `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 8) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:115 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:115-131 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/02_step_user_input_and_tool_confirmation.py:126-142 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:145-161 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/04_router_selection_and_tool_confirmation.py:152-168 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:109-125 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:129-145 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:144-160 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:234-250 — before extracting anything, compare `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py` and `cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (16–17 lines × 4) · ×2
  • Duplicated block (16–17 lines × 4) libs/agno/agno/db/mysql/async_mysql.py:2019 — libs/agno/agno/db/mysql/async_mysql.py:2019-2034 | libs/agno/agno/db/mysql/mysql.py:1990-2005 | REDACTED:2525-2541 | REDACTED:2780-2796 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2019` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–17 lines × 4) libs/agno/agno/models/ibm/watsonx.py:172 — libs/agno/agno/models/ibm/watsonx.py:172-187 | libs/agno/agno/models/ibm/watsonx.py:209-224 | libs/agno/agno/models/ibm/watsonx.py:246-261 | libs/agno/agno/models/ibm/watsonx.py:282-298 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 5) · ×2
  • Duplicated block (15–16 lines × 5) libs/agno/agno/agent/_storage.py:617 — libs/agno/agno/agent/_storage.py:617-632 | libs/agno/agno/team/_storage.py:175-190 | libs/agno/agno/utils/agent.py:1148-1163 | libs/agno/agno/utils/agent.py:1177-1191 | libs/agno/agno/workflow/workflow.py:11356-11371 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_storage.py:617` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–16 lines × 5) libs/agno/agno/utils/print_response/team.py:643 — libs/agno/agno/utils/print_response/team.py:643-658 | libs/agno/agno/utils/print_response/team.py:880-894 | libs/agno/agno/utils/print_response/team.py:1574-1589 | libs/agno/agno/utils/print_response/team.py:1727-1741 | libs/agno/agno/utils/print_response/team.py:1829-1843 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 4) · ×2
  • Duplicated block (15–16 lines × 4) libs/agno/agno/workflow/workflow.py:7173 — libs/agno/agno/workflow/workflow.py:7173-7188 | libs/agno/agno/workflow/workflow.py:8077-8091 | libs/agno/agno/workflow/workflow.py:9233-9247 | libs/agno/agno/workflow/workflow.py:9836-9850 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15–16 lines × 4) libs/agno_infra/agno/aws/resource/ec2/security_group.py:356 — libs/agno_infra/agno/aws/resource/ec2/security_group.py:356-371 | libs/agno_infra/agno/aws/resource/ec2/security_group.py:447-462 | libs/agno_infra/agno/aws/resource/ec2/security_group.py:491-506 | libs/agno_infra/agno/aws/resource/ec2/security_group.py:573-587 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/resource/ec2/security_group.py:356` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (4–16 lines × 4) · ×2
  • Duplicated block (4–16 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7161 — libs/agno/agno/db/postgres/async_postgres.py:7161-7164 | libs/agno/agno/db/postgres/postgres.py:9876-9891 | REDACTED:6330-6333 | REDACTED:8805-8820 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (4–16 lines × 4) libs/agno/agno/tools/google/gmail.py:445 — libs/agno/agno/tools/google/gmail.py:445-448 | libs/agno/agno/tools/google/gmail.py:550-565 | libs/agno/agno/tools/google/gmail.py:609-612 | libs/agno/agno/tools/google/gmail.py:819-835 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–16 lines × 2) · ×2
  • Duplicated block (9–16 lines × 2) libs/agno/agno/knowledge/knowledge.py:2979 — libs/agno/agno/knowledge/knowledge.py:2979-2994 | libs/agno/agno/knowledge/knowledge.py:3102-3110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–16 lines × 2) libs/agno/agno/os/routers/knowledge/knowledge.py:669 — libs/agno/agno/os/routers/knowledge/knowledge.py:669-677 | libs/agno/agno/os/routers/knowledge/knowledge.py:710-725 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/knowledge/knowledge.py:669` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/routers/knowledge/knowledge.py:726` calls `get_scoped_user_id` and `libs/agno/agno/os/routers/knowledge/knowledge.py:678` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15 lines × 6) · ×2
  • Duplicated block (15 lines × 6) libs/agno/agno/db/mysql/mysql.py:1394 — libs/agno/agno/db/mysql/mysql.py:1394-1408 | libs/agno/agno/db/mysql/mysql.py:1444-1458 | libs/agno/agno/db/mysql/mysql.py:1494-1508 | libs/agno/agno/db/singlestore/singlestore.py:1445-1459 | libs/agno/agno/db/singlestore/singlestore.py:1495-1509 | libs/agno/agno/db/singlestore/singlestore.py:1545-1559 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1394` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 6) libs/agno/agno/workflow/condition.py:566 — libs/agno/agno/workflow/condition.py:566-580 | libs/agno/agno/workflow/condition.py:1021-1035 | libs/agno/agno/workflow/router.py:670-684 | libs/agno/agno/workflow/router.py:1004-1018 | libs/agno/agno/workflow/steps.py:285-299 | libs/agno/agno/workflow/steps.py:591-605 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:566` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×2
  • Duplicated block (14–15 lines × 3) libs/agno/agno/team/_run.py:1280 — libs/agno/agno/team/_run.py:1280-1294 | libs/agno/agno/team/_run.py:6876-6889 | libs/agno/agno/team/_run.py:8243-8257 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 3) libs/agno/agno/sandbox/coordinator.py:109 — libs/agno/agno/sandbox/coordinator.py:109-122 | libs/agno/agno/sandbox/coordinator.py:150-164 | libs/agno/agno/sandbox/coordinator.py:311-324 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/sandbox/coordinator.py:150` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×2
  • Duplicated block (12–15 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:2358 — libs/agno/agno/db/dynamo/dynamo.py:2358-2372 | libs/agno/agno/db/dynamo/dynamo.py:2906-2917 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–15 lines × 2) REDACTED:456 — REDACTED:456-470 | REDACTED:3670-3681 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–15 lines × 2) · ×2
  • Duplicated block (11–15 lines × 2) libs/agno/agno/team/_default_tools.py:510 — libs/agno/agno/team/_default_tools.py:510-524 | libs/agno/agno/team/_task_tools.py:324-334 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11–15 lines × 2) libs/agno/agno/workflow/workflow.py:3836 — libs/agno/agno/workflow/workflow.py:3836-3850 | libs/agno/agno/workflow/workflow.py:7490-7500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14 lines × 7) · ×2
  • Duplicated block (14 lines × 7) cookbook/12_context/18_gmail.py:67 — cookbook/12_context/18_gmail.py:67-80 | cookbook/12_context/18_gmail.py:102-115 | cookbook/12_context/19_calendar.py:67-81 | cookbook/12_context/19_calendar.py:103-116 | cookbook/12_context/25_write_tools_restriction.py:65-78 | cookbook/12_context/25_write_tools_restriction.py:110-123 | cookbook/12_context/25_write_tools_restriction.py:157-170 — before extracting anything, compare `cookbook/12_context/18_gmail.py` and `cookbook/12_context/19_calendar.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/12_context/18_gmail.py:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:564 — libs/agno/agno/db/mysql/async_mysql.py:564-577 | libs/agno/agno/db/mysql/mysql.py:560-573 | libs/agno/agno/db/postgres/async_postgres.py:861-874 | libs/agno/agno/db/postgres/postgres.py:1017-1030 | libs/agno/agno/db/singlestore/singlestore.py:639-652 | REDACTED:816-829 | REDACTED:981-997 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:564` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–14 lines × 2) · ×2
  • Duplicated block (8–14 lines × 2) libs/agno/agno/os/authz/native_engine.py:483 — libs/agno/agno/os/authz/native_engine.py:483-496 | libs/agno/agno/os/authz/native_engine.py:761-768 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–14 lines × 2) libs/agno/agno/os/routers/traces/schemas.py:109 — libs/agno/agno/os/routers/traces/schemas.py:109-122 | libs/agno/agno/os/routers/traces/schemas.py:381-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 9) · ×2
  • Duplicated block (13 lines × 9) libs/agno/agno/reasoning/anthropic.py:76 — libs/agno/agno/reasoning/anthropic.py:76-88 | libs/agno/agno/reasoning/azure_ai_foundry.py:24-36 | libs/agno/agno/reasoning/deepseek.py:42-54 | libs/agno/agno/reasoning/gemini.py:63-75 | libs/agno/agno/reasoning/groq.py:31-43 | libs/agno/agno/reasoning/moonshot.py:79-92 | libs/agno/agno/reasoning/ollama.py:81-93 | libs/agno/agno/reasoning/openai.py:53-65 | libs/agno/agno/reasoning/vertexai.py:30-42 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/azure_ai_foundry.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 9) libs/agno/agno/reasoning/anthropic.py:155 — libs/agno/agno/reasoning/anthropic.py:155-167 | libs/agno/agno/reasoning/azure_ai_foundry.py:58-70 | libs/agno/agno/reasoning/deepseek.py:121-133 | libs/agno/agno/reasoning/gemini.py:93-105 | libs/agno/agno/reasoning/groq.py:69-81 | libs/agno/agno/reasoning/moonshot.py:114-126 | libs/agno/agno/reasoning/ollama.py:115-127 | libs/agno/agno/reasoning/openai.py:92-104 | libs/agno/agno/reasoning/vertexai.py:67-79 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/azure_ai_foundry.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 7) · ×2
  • Duplicated block (13 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:192 — libs/agno/agno/db/mysql/async_mysql.py:192-204 | libs/agno/agno/db/mysql/mysql.py:187-199 | libs/agno/agno/db/postgres/async_postgres.py:363-375 | libs/agno/agno/db/postgres/postgres.py:401-413 | libs/agno/agno/db/singlestore/singlestore.py:254-266 | REDACTED:347-359 | REDACTED:408-420 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 7) libs/agno/agno/workflow/workflow.py:3033 — libs/agno/agno/workflow/workflow.py:3033-3045 | libs/agno/agno/workflow/workflow.py:7141-7153 | libs/agno/agno/workflow/workflow.py:7217-7229 | libs/agno/agno/workflow/workflow.py:7332-7344 | libs/agno/agno/workflow/workflow.py:9201-9213 | libs/agno/agno/workflow/workflow.py:9275-9287 | libs/agno/agno/workflow/workflow.py:9382-9394 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–13 lines × 6) · ×2
  • Duplicated block (10–13 lines × 6) libs/agno/agno/utils/print_response/team.py:272 — libs/agno/agno/utils/print_response/team.py:272-284 | libs/agno/agno/utils/print_response/team.py:654-664 | libs/agno/agno/utils/print_response/team.py:891-900 | libs/agno/agno/utils/print_response/team.py:1208-1217 | libs/agno/agno/utils/print_response/team.py:1585-1595 | libs/agno/agno/utils/print_response/team.py:1840-1849 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/utils/print_response/team.py:287` calls `clear` and `libs/agno/agno/utils/print_response/team.py:668` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–13 lines × 6) libs/agno/agno/workflow/step.py:1152 — libs/agno/agno/workflow/step.py:1152-1164 | libs/agno/agno/workflow/step.py:1508-1517 | libs/agno/agno/workflow/step.py:1836-1845 | libs/agno/agno/workflow/step.py:1865-1874 | libs/agno/agno/workflow/step.py:2169-2178 | libs/agno/agno/workflow/step.py:2233-2242 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/step.py:1152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 4) · ×2
  • Duplicated block (11–13 lines × 4) libs/agno/agno/db/mysql/mysql.py:1815 — libs/agno/agno/db/mysql/mysql.py:1815-1827 | libs/agno/agno/db/mysql/mysql.py:2352-2362 | libs/agno/agno/db/postgres/postgres.py:2692-2704 | libs/agno/agno/db/singlestore/singlestore.py:1839-1851 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1815` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–13 lines × 4) libs/agno/agno/utils/print_response/agent.py:132 — libs/agno/agno/utils/print_response/agent.py:132-144 | libs/agno/agno/utils/print_response/agent.py:339-349 | libs/agno/agno/utils/print_response/team.py:487-497 | libs/agno/agno/utils/print_response/team.py:1419-1429 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `None` to `"tool") and response_event.tool is not` in one and `"tool") and resp.tool is not` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×2
  • Duplicated block (12–13 lines × 3) libs/agno/agno/db/valkey/valkey.py:751 — libs/agno/agno/db/valkey/valkey.py:751-763 | libs/agno/agno/db/valkey/valkey.py:1333-1345 | libs/agno/agno/db/valkey/valkey.py:2187-2198 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/valkey/valkey.py:1346` calls `log_debug` and `libs/agno/agno/db/valkey/valkey.py:764` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–13 lines × 3) libs/agno/agno/team/_run.py:393 — libs/agno/agno/team/_run.py:393-404 | libs/agno/agno/team/_run.py:1261-1273 | libs/agno/agno/team/_run.py:8227-8238 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×2
  • Duplicated block (10–13 lines × 2) REDACTED:346 — REDACTED:346-358 | REDACTED:657-666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:346` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–13 lines × 2) libs/agno/agno/os/routers/traces/traces.py:735 — libs/agno/agno/os/routers/traces/traces.py:735-747 | libs/agno/agno/os/routers/traces/traces.py:782-791 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/traces/traces.py:735` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 7) · ×2
  • Duplicated block (12 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2665 — libs/agno/agno/db/mysql/async_mysql.py:2665-2676 | libs/agno/agno/db/mysql/mysql.py:2634-2645 | libs/agno/agno/db/postgres/async_postgres.py:3037-3048 | libs/agno/agno/db/postgres/postgres.py:3581-3592 | libs/agno/agno/db/singlestore/singlestore.py:2630-2641 | REDACTED:3188-3199 | REDACTED:3441-3452 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2997 — libs/agno/agno/db/mysql/async_mysql.py:2997-3008 | libs/agno/agno/db/mysql/mysql.py:2964-2975 | libs/agno/agno/db/postgres/async_postgres.py:3380-3391 | libs/agno/agno/db/postgres/postgres.py:3924-3935 | libs/agno/agno/db/singlestore/singlestore.py:2904-2915 | REDACTED:3526-3537 | REDACTED:3721-3732 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–12 lines × 6) · ×2
  • Duplicated block (11–12 lines × 6) libs/agno/agno/agent/_run.py:728 — libs/agno/agno/agent/_run.py:728-739 | libs/agno/agno/agent/_run.py:1271-1282 | libs/agno/agno/agent/_run.py:3843-3853 | libs/agno/agno/agent/_run.py:4153-4163 | libs/agno/agno/team/_run.py:1399-1410 | libs/agno/agno/team/_run.py:1863-1874 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_run.py:1285` calls `create_run_error_event`, `str`, `error_type_of` and `libs/agno/agno/agent/_run.py:743` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11–12 lines × 6) libs/agno/agno/db/json/json_db.py:683 — libs/agno/agno/db/json/json_db.py:683-693 | libs/agno/agno/db/mongo/async_mongo.py:1066-1077 | libs/agno/agno/db/mongo/mongo.py:878-888 | libs/agno/agno/db/mysql/async_mysql.py:1132-1143 | libs/agno/agno/db/mysql/mysql.py:1125-1136 | libs/agno/agno/db/singlestore/singlestore.py:1181-1192 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1066` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–12 lines × 3) · ×2
  • Duplicated block (10–12 lines × 3) libs/agno/agno/agent/_storage.py:498 — libs/agno/agno/agent/_storage.py:498-509 | libs/agno/agno/team/_storage.py:277-287 | libs/agno/agno/workflow/workflow.py:2184-2193 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–12 lines × 3) REDACTED:2283 — REDACTED:2283-2294 | REDACTED:2855-2864 | REDACTED:2986-2997 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×2
  • Duplicated block (11–12 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1764 — libs/agno/agno/db/mysql/async_mysql.py:1764-1774 | libs/agno/agno/db/postgres/async_postgres.py:2160-2170 | REDACTED:2280-2291 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 3) libs/agno/agno/tools/google/gmail.py:1483 — libs/agno/agno/tools/google/gmail.py:1483-1494 | libs/agno/agno/tools/google/gmail.py:1607-1617 | libs/agno/agno/tools/google/gmail.py:1668-1679 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–12 lines × 2) · ×2
  • Duplicated block (8–12 lines × 2) cookbook/05_agent_os/22_studio/standalone_studio_agent.py:139 — cookbook/05_agent_os/22_studio/standalone_studio_agent.py:139-150 | cookbook/05_agent_os/22_studio/standalone_studio_agent.py:162-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/22_studio/standalone_studio_agent.py:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–12 lines × 2) libs/agno/agno/db/firestore/firestore.py:916 — libs/agno/agno/db/firestore/firestore.py:916-923 | REDACTED:1951-1962 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 9) · ×2
  • Duplicated block (11 lines × 9) libs/agno/agno/db/dynamo/utils.py:402 — libs/agno/agno/db/dynamo/utils.py:402-412 | libs/agno/agno/db/gcs_json/utils.py:98-108 | libs/agno/agno/db/in_memory/utils.py:98-108 | libs/agno/agno/db/json/utils.py:98-108 | libs/agno/agno/db/mysql/utils.py:280-290 | libs/agno/agno/db/postgres/utils.py:330-340 | libs/agno/agno/db/redis/utils.py:244-254 | libs/agno/agno/db/singlestore/utils.py:307-317 | libs/agno/agno/db/surrealdb/metrics.py:319-329 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/gcs_json/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 102 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (11 lines × 9) libs/agno/agno/db/dynamo/utils.py:416 — libs/agno/agno/db/dynamo/utils.py:416-426 | libs/agno/agno/db/firestore/utils.py:257-267 | libs/agno/agno/db/mongo/utils.py:199-209 | libs/agno/agno/db/mysql/utils.py:294-304 | libs/agno/agno/db/postgres/utils.py:345-355 | libs/agno/agno/db/redis/utils.py:258-268 | libs/agno/agno/db/singlestore/utils.py:321-331 | libs/agno/agno/db/sqlite/utils.py:310-320 | libs/agno/agno/db/valkey/utils.py:453-463 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/firestore/utils.py:273` calls `sha256`, `encode`, `hexdigest` and `libs/agno/agno/db/dynamo/utils.py:430` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–11 lines × 6) · ×2
  • Duplicated block (8–11 lines × 6) libs/agno/agno/agent/_run.py:6041 — libs/agno/agno/agent/_run.py:6041-6051 | libs/agno/agno/agent/_run.py:6081-6088 | libs/agno/agno/team/_run.py:4659-4669 | libs/agno/agno/team/_run.py:4742-4752 | libs/agno/agno/team/_run.py:4888-4895 | libs/agno/agno/team/_run.py:4948-4955 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8–11 lines × 6) libs/agno/agno/knowledge/knowledge.py:4041 — libs/agno/agno/knowledge/knowledge.py:4041-4048 | libs/agno/agno/knowledge/loaders/azure_blob.py:254-264 | libs/agno/agno/knowledge/loaders/gcs.py:148-158 | libs/agno/agno/knowledge/loaders/github.py:448-458 | libs/agno/agno/knowledge/loaders/s3.py:132-142 | libs/agno/agno/knowledge/loaders/sharepoint.py:300-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/loaders/azure_blob.py:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×2
  • Duplicated block (11 lines × 6) libs/agno/agno/db/mongo/async_mongo.py:749 — libs/agno/agno/db/mongo/async_mongo.py:749-759 | libs/agno/agno/db/mongo/async_mongo.py:1589-1599 | libs/agno/agno/db/mongo/async_mongo.py:2391-2401 | libs/agno/agno/db/mongo/mongo.py:553-563 | libs/agno/agno/db/mongo/mongo.py:1395-1405 | libs/agno/agno/db/mongo/mongo.py:2197-2207 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 6) libs/agno/agno/db/postgres/async_postgres.py:4509 — libs/agno/agno/db/postgres/async_postgres.py:4509-4519 | libs/agno/agno/db/postgres/async_postgres.py:4734-4744 | libs/agno/agno/db/postgres/async_postgres.py:6005-6015 | REDACTED:4582-4592 | REDACTED:4824-4834 | REDACTED:5172-5182 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–11 lines × 6) · ×2
  • Duplicated block (10–11 lines × 6) libs/agno/agno/learn/schemas.py:136 — libs/agno/agno/learn/schemas.py:136-146 | libs/agno/agno/learn/schemas.py:234-244 | libs/agno/agno/learn/schemas.py:398-407 | libs/agno/agno/learn/schemas.py:494-503 | libs/agno/agno/learn/schemas.py:636-645 | libs/agno/agno/learn/schemas.py:1126-1135 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 6) libs/agno/agno/tools/studio_runner.py:2725 — libs/agno/agno/tools/studio_runner.py:2725-2735 | libs/agno/agno/tools/studio_runner.py:2791-2801 | libs/agno/agno/tools/studio_runner.py:2858-2867 | libs/agno/agno/tools/studio_runner.py:2926-2936 | libs/agno/agno/tools/studio_runner.py:2992-3002 | libs/agno/agno/tools/studio_runner.py:3061-3070 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio_runner.py:2725` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 8) · ×2
  • Duplicated block (10 lines × 8) libs/agno/agno/agent/_default_tools.py:150 — libs/agno/agno/agent/_default_tools.py:150-159 | libs/agno/agno/agent/_default_tools.py:183-192 | libs/agno/agno/agent/_default_tools.py:218-227 | libs/agno/agno/agent/_default_tools.py:247-256 | libs/agno/agno/team/_default_tools.py:1656-1665 | libs/agno/agno/team/_default_tools.py:1687-1696 | libs/agno/agno/team/_default_tools.py:1720-1729 | libs/agno/agno/team/_default_tools.py:1747-1756 — `libs/agno/agno/agent/_default_tools.py` and `libs/agno/agno/team/_default_tools.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 262 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_default_tools.py:150` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 8) REDACTED:404 — REDACTED:404-413 | libs/agno/agno/db/mongo/mongo.py:2342-2351 | libs/agno/agno/db/mysql/async_mysql.py:2792-2801 | libs/agno/agno/db/mysql/mysql.py:2759-2768 | libs/agno/agno/db/postgres/async_postgres.py:3166-3175 | libs/agno/agno/db/postgres/postgres.py:3710-3719 | REDACTED:3318-3327 | REDACTED:4324-4333 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 8 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 8 times.
D4 · Code Duplication · Duplicated block (9–10 lines × 7) · ×2
  • Duplicated block (9–10 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:2680 — libs/agno/agno/db/mysql/async_mysql.py:2680-2689 | libs/agno/agno/db/mysql/mysql.py:2649-2658 | libs/agno/agno/db/postgres/async_postgres.py:3052-3061 | libs/agno/agno/db/postgres/postgres.py:3596-3605 | libs/agno/agno/db/singlestore/singlestore.py:2645-2654 | REDACTED:3203-3211 | REDACTED:3456-3464 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9–10 lines × 7) libs/agno/agno/os/routers/components/components.py:888 — libs/agno/agno/os/routers/components/components.py:888-896 | libs/agno/agno/os/routers/components/components.py:1036-1045 | libs/agno/agno/os/routers/components/components.py:1141-1149 | libs/agno/agno/os/routers/components/components.py:1238-1246 | libs/agno/agno/os/routers/components/components.py:1306-1315 | libs/agno/agno/os/routers/components/components.py:1416-1425 | libs/agno/agno/os/routers/components/components.py:1484-1493 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/components/components.py:1036` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 5) · ×2
  • Duplicated block (9–10 lines × 5) cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:116 — cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:116-124 | cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:134-142 | cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:166-174 | cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:190-199 | cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:246-254 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 5) libs/agno/agno/os/routers/schedules/router.py:301 — libs/agno/agno/os/routers/schedules/router.py:301-310 | libs/agno/agno/os/routers/schedules/router.py:408-416 | libs/agno/agno/os/routers/schedules/router.py:431-440 | libs/agno/agno/os/routers/schedules/router.py:506-515 | libs/agno/agno/os/routers/schedules/router.py:537-546 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×2
  • Duplicated block (10 lines × 5) libs/agno/agno/db/mysql/mysql.py:2235 — libs/agno/agno/db/mysql/mysql.py:2235-2244 | libs/agno/agno/db/postgres/postgres.py:3144-3153 | libs/agno/agno/db/singlestore/singlestore.py:2262-2271 | REDACTED:2809-2818 | REDACTED:3061-3070 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 5) libs/agno/agno/os/routers/agents/router.py:763 — libs/agno/agno/os/routers/agents/router.py:763-772 | libs/agno/agno/os/routers/agents/router.py:1468-1477 | libs/agno/agno/os/routers/teams/router.py:677-686 | libs/agno/agno/os/routers/teams/router.py:1430-1439 | libs/agno/agno/os/routers/workflows/router.py:1855-1864 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/agents/router.py:761` calls `log_warning` and `libs/agno/agno/os/routers/agents/router.py:1467` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 3) · ×2
  • Duplicated block (8–10 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2727 — libs/agno/agno/db/mysql/async_mysql.py:2727-2734 | libs/agno/agno/db/postgres/async_postgres.py:3101-3110 | REDACTED:3252-3259 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:3100` calls `sanitize_postgres_string` and `libs/agno/agno/db/mysql/async_mysql.py:2726` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8–10 lines × 3) libs/agno/agno/os/routers/workflows/router.py:1221 — libs/agno/agno/os/routers/workflows/router.py:1221-1228 | libs/agno/agno/workflow/workflow.py:5291-5300 | libs/agno/agno/workflow/workflow.py:10424-10433 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×2
  • Duplicated block (7–10 lines × 2) libs/agno/agno/agent/_tools.py:1134 — libs/agno/agno/agent/_tools.py:1134-1140 | libs/agno/agno/team/_run.py:5468-5477 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:1134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–10 lines × 2) libs/agno/agno/agent/_tools.py:1244 — libs/agno/agno/agent/_tools.py:1244-1250 | libs/agno/agno/team/_run.py:5622-5631 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:1244` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 9) · ×2
  • Duplicated block (9 lines × 9) libs/agno/agno/db/mysql/mysql.py:1398 — libs/agno/agno/db/mysql/mysql.py:1398-1406 | libs/agno/agno/db/mysql/mysql.py:1448-1456 | libs/agno/agno/db/mysql/mysql.py:1498-1506 | libs/agno/agno/db/singlestore/singlestore.py:1449-1457 | libs/agno/agno/db/singlestore/singlestore.py:1499-1507 | libs/agno/agno/db/singlestore/singlestore.py:1549-1557 | REDACTED:2164-2172 | REDACTED:2224-2232 | REDACTED:2284-2292 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1398` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:2163` calls `is_` and `libs/agno/agno/db/mysql/mysql.py:1397` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 9) libs/agno/agno/db/postgres/async_postgres.py:4267 — libs/agno/agno/db/postgres/async_postgres.py:4267-4275 | libs/agno/agno/db/postgres/postgres.py:6742-6750 | libs/agno/agno/db/postgres/postgres.py:6936-6944 | libs/agno/agno/db/postgres/postgres.py:7000-7008 | REDACTED:4144-4152 | REDACTED:4341-4349 | REDACTED:6513-6521 | REDACTED:6707-6715 | REDACTED:6769-6777 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 6) · ×2
  • Duplicated block (9 lines × 6) libs/agno/agno/db/postgres/async_postgres.py:4009 — libs/agno/agno/db/postgres/async_postgres.py:4009-4017 | libs/agno/agno/db/postgres/async_postgres.py:4202-4210 | libs/agno/agno/db/postgres/async_postgres.py:4338-4346 | libs/agno/agno/db/postgres/postgres.py:7069-7077 | REDACTED:4410-4418 | REDACTED:6837-6845 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 6) REDACTED:1915 — REDACTED:1915-1923 | REDACTED:1975-1983 | REDACTED:2035-2043 | REDACTED:2172-2180 | REDACTED:2232-2240 | REDACTED:2292-2300 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–9 lines × 4) · ×2
  • Duplicated block (7–9 lines × 4) libs/agno/agno/db/mysql/mysql.py:843 — libs/agno/agno/db/mysql/mysql.py:843-849 | libs/agno/agno/db/postgres/postgres.py:1362-1370 | libs/agno/agno/db/singlestore/singlestore.py:897-903 | REDACTED:1351-1359 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/postgres.py:1360` calls `run_ids` and `libs/agno/agno/db/mysql/mysql.py:841` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–9 lines × 4) libs/agno/agno/team/_run.py:5217 — libs/agno/agno/team/_run.py:5217-5223 | libs/agno/agno/team/_run.py:5249-5255 | libs/agno/agno/utils/callables.py:152-160 | libs/agno/agno/utils/callables.py:188-196 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:5259` calls `iscoroutine` and `libs/agno/agno/team/_run.py:5227` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 4) · ×2
  • Duplicated block (8–9 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:5957 — libs/agno/agno/db/postgres/async_postgres.py:5957-5964 | libs/agno/agno/db/postgres/postgres.py:8723-8731 | REDACTED:5124-5131 | REDACTED:7655-7662 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8–9 lines × 4) libs/agno/agno/knowledge/reader/markdown_reader.py:75 — libs/agno/agno/knowledge/reader/markdown_reader.py:75-83 | libs/agno/agno/knowledge/reader/markdown_reader.py:113-120 | libs/agno/agno/knowledge/reader/text_reader.py:47-55 | libs/agno/agno/knowledge/reader/text_reader.py:91-98 — before extracting anything, compare `libs/agno/agno/knowledge/reader/markdown_reader.py` and `libs/agno/agno/knowledge/reader/text_reader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/reader/markdown_reader.py:75` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×2
  • Duplicated block (7–9 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:892 — libs/agno/agno/db/mysql/async_mysql.py:892-898 | libs/agno/agno/db/mysql/mysql.py:886-894 | libs/agno/agno/db/singlestore/singlestore.py:940-948 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7–9 lines × 3) libs/agno/agno/db/mysql/mysql.py:290 — libs/agno/agno/db/mysql/mysql.py:290-296 | libs/agno/agno/db/postgres/async_postgres.py:475-483 | libs/agno/agno/db/postgres/postgres.py:572-579 — before extracting anything, compare `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` as WHOLE FILES: this scan already matched 44 separate duplicated blocks between them, totalling at least 556 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 15) · ×2
  • Duplicated block (8 lines × 15) libs/agno/agno/db/postgres/async_postgres.py:4013 — libs/agno/agno/db/postgres/async_postgres.py:4013-4020 | libs/agno/agno/db/postgres/async_postgres.py:4206-4213 | libs/agno/agno/db/postgres/async_postgres.py:4271-4278 | libs/agno/agno/db/postgres/async_postgres.py:4342-4349 | libs/agno/agno/db/postgres/postgres.py:6746-6753 | libs/agno/agno/db/postgres/postgres.py:6940-6947 | libs/agno/agno/db/postgres/postgres.py:7004-7011 | libs/agno/agno/db/postgres/postgres.py:7073-7080 | REDACTED:4148-4155 | REDACTED:4345-4352 | REDACTED:4414-4421 | REDACTED:6517-6524 | REDACTED:6711-6718 | REDACTED:6773-6780 | REDACTED:6841-6848 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 15) REDACTED:280 — REDACTED:280-287 | REDACTED:498-505 | REDACTED:704-711 | REDACTED:438-445 | REDACTED:1116-1123 | REDACTED:1230-1237 | REDACTED:642-649 | REDACTED:819-826 | REDACTED:1187-1194 | REDACTED:1266-1273 | REDACTED:762-769 | REDACTED:408-415 | REDACTED:700-707 | REDACTED:797-804 | REDACTED:415-422 — there are 15 copies across 10 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 15 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:709` calls `begin` and `REDACTED:447` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 9) · ×2
  • Duplicated block (8 lines × 9) libs/agno/agno/reasoning/anthropic.py:124 — libs/agno/agno/reasoning/anthropic.py:124-131 | libs/agno/agno/reasoning/azure_ai_foundry.py:104-111 | libs/agno/agno/reasoning/deepseek.py:87-94 | libs/agno/agno/reasoning/gemini.py:133-140 | libs/agno/agno/reasoning/groq.py:120-127 | libs/agno/agno/reasoning/moonshot.py:159-166 | libs/agno/agno/reasoning/ollama.py:161-168 | libs/agno/agno/reasoning/openai.py:143-150 | libs/agno/agno/reasoning/vertexai.py:115-122 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/azure_ai_foundry.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/reasoning/azure_ai_foundry.py:113` calls `hasattr` and `libs/agno/agno/reasoning/anthropic.py:132` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 9) libs/agno/agno/reasoning/anthropic.py:203 — libs/agno/agno/reasoning/anthropic.py:203-210 | libs/agno/agno/reasoning/azure_ai_foundry.py:150-157 | libs/agno/agno/reasoning/deepseek.py:166-173 | libs/agno/agno/reasoning/gemini.py:173-180 | libs/agno/agno/reasoning/groq.py:171-178 | libs/agno/agno/reasoning/moonshot.py:204-211 | libs/agno/agno/reasoning/ollama.py:207-214 | libs/agno/agno/reasoning/openai.py:199-206 | libs/agno/agno/reasoning/vertexai.py:157-164 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/azure_ai_foundry.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/reasoning/azure_ai_foundry.py:159` calls `hasattr` and `libs/agno/agno/reasoning/anthropic.py:211` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 8) · ×2
  • Duplicated block (8 lines × 8) libs/agno/agno/db/mongo/async_mongo.py:752 — libs/agno/agno/db/mongo/async_mongo.py:752-759 | libs/agno/agno/db/mongo/async_mongo.py:1592-1599 | libs/agno/agno/db/mongo/async_mongo.py:2394-2401 | libs/agno/agno/db/mongo/mongo.py:556-563 | libs/agno/agno/db/mongo/mongo.py:1398-1405 | libs/agno/agno/db/mongo/mongo.py:2200-2207 | libs/agno/agno/db/redis/redis.py:520-527 | libs/agno/agno/db/valkey/valkey.py:606-613 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 8) libs/agno/agno/workflow/condition.py:637 — libs/agno/agno/workflow/condition.py:637-644 | libs/agno/agno/workflow/condition.py:892-899 | libs/agno/agno/workflow/condition.py:1090-1097 | libs/agno/agno/workflow/condition.py:1346-1353 | libs/agno/agno/workflow/router.py:741-748 | libs/agno/agno/workflow/router.py:915-922 | libs/agno/agno/workflow/router.py:1078-1085 | libs/agno/agno/workflow/router.py:1256-1263 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6–8 lines × 3) · ×2
  • Duplicated block (6–8 lines × 3) REDACTED:107 — REDACTED:107-114 | REDACTED:117-124 | REDACTED:84-89 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6–8 lines × 3) libs/agno/agno/db/clickhouse/utils.py:234 — libs/agno/agno/db/clickhouse/utils.py:234-242 | libs/agno/agno/db/clickhouse/utils.py:245-252 | libs/agno/agno/db/clickhouse/utils.py:253-258 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/clickhouse/utils.py:233` calls `get` and `libs/agno/agno/db/clickhouse/utils.py:253` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 11) · ×2
  • Duplicated block (7 lines × 11) libs/agno/agno/db/mysql/async_mysql.py:1732 — libs/agno/agno/db/mysql/async_mysql.py:1732-1738 | libs/agno/agno/db/mysql/mysql.py:1713-1719 | libs/agno/agno/db/postgres/async_postgres.py:2131-2137 | libs/agno/agno/db/postgres/async_postgres.py:3024-3031 | libs/agno/agno/db/postgres/postgres.py:2588-2594 | libs/agno/agno/db/postgres/postgres.py:3568-3575 | libs/agno/agno/db/singlestore/singlestore.py:1752-1758 | REDACTED:2252-2259 | REDACTED:3175-3182 | REDACTED:2509-2516 | REDACTED:3428-3435 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 11) libs/agno/agno/db/mysql/async_mysql.py:3078 — libs/agno/agno/db/mysql/async_mysql.py:3078-3084 | libs/agno/agno/db/mysql/mysql.py:3044-3050 | libs/agno/agno/db/postgres/async_postgres.py:3458-3464 | libs/agno/agno/db/postgres/async_postgres.py:3900-3907 | libs/agno/agno/db/postgres/postgres.py:4002-4008 | libs/agno/agno/db/postgres/postgres.py:4439-4446 | libs/agno/agno/db/singlestore/singlestore.py:2984-2990 | REDACTED:3605-3611 | REDACTED:4034-4041 | REDACTED:3805-3811 | REDACTED:4228-4235 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:3085` calls `where` and `libs/agno/agno/db/postgres/async_postgres.py:3909` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) libs/agno/agno/db/postgres/async_postgres.py:7017 — libs/agno/agno/db/postgres/async_postgres.py:7017-7023 | libs/agno/agno/db/postgres/postgres.py:9748-9754 | libs/agno/agno/db/sql/company.py:194-200 | REDACTED:6186-6192 | REDACTED:8677-8683 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `user_id` to `Optional[str] = None` in one and `Optional[str]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 5) libs/agno/agno/utils/pprint.py:49 — libs/agno/agno/utils/pprint.py:49-55 | libs/agno/agno/utils/pprint.py:132-138 | libs/agno/agno/utils/print_response/agent.py:143-149 | libs/agno/agno/utils/print_response/agent.py:348-354 | libs/agno/agno/utils/print_response/agent.py:891-897 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5 lines × 7) · ×2
  • Duplicated block (5 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:1131 — libs/agno/agno/db/mysql/async_mysql.py:1131-1135 | libs/agno/agno/db/mysql/mysql.py:1124-1128 | libs/agno/agno/db/postgres/async_postgres.py:1716-1720 | libs/agno/agno/db/postgres/postgres.py:1947-1951 | libs/agno/agno/db/singlestore/singlestore.py:1180-1184 | REDACTED:1645-1649 | REDACTED:1901-1905 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 7) cookbook/07_knowledge/09_archive/embedders/huggingface_embedder.py:31 — cookbook/07_knowledge/09_archive/embedders/huggingface_embedder.py:31-37 | cookbook/07_knowledge/09_archive/embedders/langdb_embedder.py:31-35 | cookbook/07_knowledge/09_archive/embedders/nebius_embedder.py:31-37 | cookbook/07_knowledge/09_archive/embedders/ollama_embedder.py:31-37 | cookbook/07_knowledge/09_archive/embedders/qdrant_fastembed.py:31-37 | cookbook/07_knowledge/09_archive/embedders/sentence_transformer_embedder.py:31-37 | cookbook/07_knowledge/09_archive/embedders/together_embedder.py:31-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (6 lines × 12) · ×2
  • Duplicated block (6 lines × 12) libs/agno/agno/db/dynamo/utils.py:457 — libs/agno/agno/db/dynamo/utils.py:457-467 | libs/agno/agno/db/firestore/utils.py:322-327 | libs/agno/agno/db/gcs_json/utils.py:193-205 | libs/agno/agno/db/in_memory/utils.py:193-205 | libs/agno/agno/db/json/utils.py:193-205 | libs/agno/agno/db/mongo/utils.py:260-265 | libs/agno/agno/db/mysql/utils.py:371-383 | libs/agno/agno/db/postgres/utils.py:423-435 | libs/agno/agno/db/redis/utils.py:330-342 | libs/agno/agno/db/singlestore/utils.py:398-410 | libs/agno/agno/db/sqlite/utils.py:388-400 | libs/agno/agno/db/valkey/utils.py:525-537 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 12) libs/agno/agno/db/postgres/async_postgres.py:6583 — libs/agno/agno/db/postgres/async_postgres.py:6583-6588 | libs/agno/agno/db/postgres/async_postgres.py:6709-6714 | libs/agno/agno/db/postgres/async_postgres.py:6976-6981 | libs/agno/agno/db/postgres/postgres.py:9330-9335 | libs/agno/agno/db/postgres/postgres.py:9454-9459 | libs/agno/agno/db/postgres/postgres.py:9711-9716 | REDACTED:5752-5757 | REDACTED:5878-5883 | REDACTED:6145-6150 | REDACTED:8259-8264 | REDACTED:8383-8388 | REDACTED:8640-8645 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.2 · ×1
  • Low contrast colour pair in CSS (3.2:1) cookbook/07_knowledge/testing_resources/company_info.html:7 — `th` sets color: white on background-color: #3498db — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 6 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · Workflow._acontinue_execute_stream (cyclomatic 164) · ×1
  • Workflow._acontinue_execute_stream (cyclomatic 164) libs/agno/agno/workflow/workflow.py:9566 — Workflow._acontinue_execute_stream has cyclomatic complexity 164 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._continue_execute_stream (cyclomatic 163) · ×1
  • Workflow._continue_execute_stream (cyclomatic 163) libs/agno/agno/workflow/workflow.py:7806 — Workflow._continue_execute_stream has cyclomatic complexity 163 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · team.aprint_response_stream (cyclomatic 160) · ×1
  • team.aprint_response_stream (cyclomatic 160) libs/agno/agno/utils/print_response/team.py:1292 — team.aprint_response_stream has cyclomatic complexity 160 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.stream_a2a_response (cyclomatic 154) · ×1
  • utils.stream_a2a_response (cyclomatic 154) libs/agno/agno/os/interfaces/a2a/utils.py:304 — utils.stream_a2a_response has cyclomatic complexity 154 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · team.print_response_stream (cyclomatic 154) · ×1
  • team.print_response_stream (cyclomatic 154) libs/agno/agno/utils/print_response/team.py:359 — team.print_response_stream has cyclomatic complexity 154 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _storage.to_dict (cyclomatic 144) · ×1
  • _storage.to_dict (cyclomatic 144) libs/agno/agno/agent/_storage.py:833 — _storage.to_dict has cyclomatic complexity 144 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _storage.to_dict (cyclomatic 141) · ×1
  • _storage.to_dict (cyclomatic 141) libs/agno/agno/team/_storage.py:513 — _storage.to_dict has cyclomatic complexity 141 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflow.print_response_stream (cyclomatic 136) · ×1
  • workflow.print_response_stream (cyclomatic 136) libs/agno/agno/utils/print_response/workflow.py:195 — workflow.print_response_stream has cyclomatic complexity 136 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.aprint_response_stream (cyclomatic 134) · ×1
  • workflow.aprint_response_stream (cyclomatic 134) libs/agno/agno/utils/print_response/workflow.py:1056 — workflow.aprint_response_stream has cyclomatic complexity 134 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._acontinue_run_stream (cyclomatic 128) · ×1
  • _run._acontinue_run_stream (cyclomatic 128) libs/agno/agno/team/_run.py:9803 — _run._acontinue_run_stream has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._aexecute_stream (cyclomatic 118) · ×1
  • Workflow._aexecute_stream (cyclomatic 118) libs/agno/agno/workflow/workflow.py:4279 — Workflow._aexecute_stream has cyclomatic complexity 118 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._acontinue_execute (cyclomatic 118) · ×1
  • Workflow._acontinue_execute (cyclomatic 118) libs/agno/agno/workflow/workflow.py:9025 — Workflow._acontinue_execute has cyclomatic complexity 118 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._continue_execute (cyclomatic 116) · ×1
  • Workflow._continue_execute (cyclomatic 116) libs/agno/agno/workflow/workflow.py:6963 — Workflow._continue_execute has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Step.aexecute_stream (cyclomatic 113) · ×1
  • Step.aexecute_stream (cyclomatic 113) libs/agno/agno/workflow/step.py:2080 — Step.aexecute_stream has cyclomatic complexity 113 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._execute_stream (cyclomatic 107) · ×1
  • Workflow._execute_stream (cyclomatic 107) libs/agno/agno/workflow/workflow.py:3275 — Workflow._execute_stream has cyclomatic complexity 107 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Step.execute_stream (cyclomatic 101) · ×1
  • Step.execute_stream (cyclomatic 101) libs/agno/agno/workflow/step.py:1418 — Step.execute_stream has cyclomatic complexity 101 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _response._handle_model_response_chunk (cyclomatic 98) · ×1
  • _response._handle_model_response_chunk (cyclomatic 98) libs/agno/agno/team/_response.py:1311 — _response._handle_model_response_chunk has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._acontinue_run_stream (cyclomatic 95) · ×1
  • _run._acontinue_run_stream (cyclomatic 95) libs/agno/agno/agent/_run.py:5190 — _run._acontinue_run_stream has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run.continue_run_dispatch (cyclomatic 95) · ×1
  • _run.continue_run_dispatch (cyclomatic 95) libs/agno/agno/team/_run.py:7375 — _run.continue_run_dispatch has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow.acontinue_run (cyclomatic 94) · ×1
  • Workflow.acontinue_run (cyclomatic 94) libs/agno/agno/workflow/workflow.py:8617 — Workflow.acontinue_run has cyclomatic complexity 94 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Step.from_dict (cyclomatic 89) · ×1
  • Step.from_dict (cyclomatic 89) libs/agno/agno/workflow/step.py:328 — Step.from_dict has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow.continue_run (cyclomatic 89) · ×1
  • Workflow.continue_run (cyclomatic 89) libs/agno/agno/workflow/workflow.py:6580 — Workflow.continue_run has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model.arun_function_calls (cyclomatic 88) · ×1
  • Model.arun_function_calls (cyclomatic 88) REDACTED:2623 — Model.arun_function_calls has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _response.handle_model_response_chunk (cyclomatic 84) · ×1
  • _response.handle_model_response_chunk (cyclomatic 84) libs/agno/agno/agent/_response.py:1359 — _response.handle_model_response_chunk has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._acontinue_run (cyclomatic 83) · ×1
  • _run._acontinue_run (cyclomatic 83) libs/agno/agno/team/_run.py:9323 — _run._acontinue_run has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _tools._determine_tools_for_model (cyclomatic 83) · ×1
  • _tools._determine_tools_for_model (cyclomatic 83) libs/agno/agno/team/_tools.py:113 — _tools._determine_tools_for_model has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Step.aexecute (cyclomatic 83) · ×1
  • Step.aexecute (cyclomatic 83) libs/agno/agno/workflow/step.py:1777 — Step.aexecute has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.aget_system_message (cyclomatic 79) · ×1
  • _messages.aget_system_message (cyclomatic 79) libs/agno/agno/agent/_messages.py:1213 — _messages.aget_system_message has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiInteractions._parse_provider_response_delta (cyclomatic 78) · ×1
  • GeminiInteractions._parse_provider_response_delta (cyclomatic 78) libs/agno/agno/models/google/gemini_interactions.py:953 — GeminiInteractions._parse_provider_response_delta has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.get_system_message (cyclomatic 76) · ×1
  • _messages.get_system_message (cyclomatic 76) libs/agno/agno/agent/_messages.py:917 — _messages.get_system_message has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _commands._cmd_rg (cyclomatic 76) · ×1
  • _commands._cmd_rg (cyclomatic 76) libs/agno/agno/knowledge/page/_commands.py:401 — _commands._cmd_rg has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · team.print_response (cyclomatic 76) · ×1
  • team.print_response (cyclomatic 76) libs/agno/agno/utils/print_response/team.py:22 — team.print_response has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · team.aprint_response (cyclomatic 75) · ×1
  • team.aprint_response (cyclomatic 75) libs/agno/agno/utils/print_response/team.py:957 — team.aprint_response has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentOS.get_app (cyclomatic 74) · ×1
  • AgentOS.get_app (cyclomatic 74) libs/agno/agno/os/app.py:1753 — AgentOS.get_app has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _storage.from_dict (cyclomatic 74) · ×1
  • _storage.from_dict (cyclomatic 74) libs/agno/agno/team/_storage.py:955 — _storage.from_dict has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PublicMiddleware.__call__ (cyclomatic 73) · ×1
  • PublicMiddleware.__call__ (cyclomatic 73) libs/agno/agno/os/public/_middleware.py:219 — PublicMiddleware.__call__ has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._arun_stream (cyclomatic 72) · ×1
  • _run._arun_stream (cyclomatic 72) libs/agno/agno/agent/_run.py:2123 — _run._arun_stream has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Step.execute (cyclomatic 72) · ×1
  • Step.execute (cyclomatic 72) libs/agno/agno/workflow/step.py:1094 — Step.execute has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AuthMiddleware._dispatch (cyclomatic 70) · ×1
  • AuthMiddleware._dispatch (cyclomatic 70) libs/agno/agno/os/middleware/jwt.py:1464 — AuthMiddleware._dispatch has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseRunOutputEvent.to_dict (cyclomatic 69) · ×1
  • BaseRunOutputEvent.to_dict (cyclomatic 69) libs/agno/agno/run/base.py:107 — BaseRunOutputEvent.to_dict has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._acontinue_run (cyclomatic 68) · ×1
  • _run._acontinue_run (cyclomatic 68) libs/agno/agno/agent/_run.py:4668 — _run._acontinue_run has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._aexecute (cyclomatic 67) · ×1
  • Workflow._aexecute (cyclomatic 67) libs/agno/agno/workflow/workflow.py:3916 — Workflow._aexecute has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DbInstance._create (cyclomatic 67) · ×1
  • DbInstance._create (cyclomatic 67) libs/agno_infra/agno/aws/resource/rds/db_instance.py:258 — DbInstance._create has cyclomatic complexity 67 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Workflow._execute (cyclomatic 65) · ×1
  • Workflow._execute (cyclomatic 65) libs/agno/agno/workflow/workflow.py:2927 — Workflow._execute has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DbInstance._update (cyclomatic 65) · ×1
  • DbInstance._update (cyclomatic 65) libs/agno_infra/agno/aws/resource/rds/db_instance.py:536 — DbInstance._update has cyclomatic complexity 65 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._arun_tasks_stream (cyclomatic 64) · ×1
  • _run._arun_tasks_stream (cyclomatic 64) libs/agno/agno/team/_run.py:2490 — _run._arun_tasks_stream has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _CompanyScheduleExecutor._accept (cyclomatic 63) · ×1
  • _CompanyScheduleExecutor._accept (cyclomatic 63) libs/agno/agno/company/routines.py:772 — _CompanyScheduleExecutor._accept has cyclomatic complexity 63 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Gemini._parse_provider_response (cyclomatic 63) · ×1
  • Gemini._parse_provider_response (cyclomatic 63) libs/agno/agno/models/google/gemini.py:1225 — Gemini._parse_provider_response has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._run_stream (cyclomatic 62) · ×1
  • _run._run_stream (cyclomatic 62) libs/agno/agno/agent/_run.py:777 — _run._run_stream has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · connect._connect (cyclomatic 62) · ×1
  • connect._connect (cyclomatic 62) libs/agnoctl/agnoctl/commands/connect.py:338 — connect._connect has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DbCluster._create (cyclomatic 61) · ×1
  • DbCluster._create (cyclomatic 61) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:336 — DbCluster._create has cyclomatic complexity 61 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GeminiInteractions._parse_provider_response (cyclomatic 60) · ×1
  • GeminiInteractions._parse_provider_response (cyclomatic 60) libs/agno/agno/models/google/gemini_interactions.py:782 — GeminiInteractions._parse_provider_response has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueWorker._execute_claimed_inner (cyclomatic 60) · ×1
  • QueueWorker._execute_claimed_inner (cyclomatic 60) libs/agno/agno/os/job_queue.py:2107 — QueueWorker._execute_claimed_inner has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Condition.execute_stream (cyclomatic 58) · ×1
  • Condition.execute_stream (cyclomatic 58) libs/agno/agno/workflow/condition.py:659 — Condition.execute_stream has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Condition.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Condition.aexecute_stream (cyclomatic 58) · ×1
  • Condition.aexecute_stream (cyclomatic 58) libs/agno/agno/workflow/condition.py:1112 — Condition.aexecute_stream has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Condition.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Message.from_dict (cyclomatic 57) · ×1
  • Message.from_dict (cyclomatic 57) libs/agno/agno/models/message.py:149 — Message.from_dict has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TeamResponse.from_team (cyclomatic 57) · ×1
  • TeamResponse.from_team (cyclomatic 57) libs/agno/agno/os/routers/teams/schema.py:73 — TeamResponse.from_team has cyclomatic complexity 57 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · claude.format_messages (cyclomatic 57) · ×1
  • claude.format_messages (cyclomatic 57) libs/agno/agno/utils/models/claude.py:609 — claude.format_messages has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.upsert_config (cyclomatic 55) · ×1
  • PostgresDb.upsert_config (cyclomatic 55) libs/agno/agno/db/postgres/postgres.py:5486 — PostgresDb.upsert_config has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.upsert_config (cyclomatic 55) · ×1
  • SqliteDb.upsert_config (cyclomatic 55) REDACTED:5289 — SqliteDb.upsert_config has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Message.log (cyclomatic 55) · ×1
  • Message.log (cyclomatic 55) libs/agno/agno/models/message.py:368 — Message.log has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.aget_system_message (cyclomatic 55) · ×1
  • _messages.aget_system_message (cyclomatic 55) libs/agno/agno/team/_messages.py:684 — _messages.aget_system_message has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model.aresponse_stream (cyclomatic 54) · ×1
  • Model.aresponse_stream (cyclomatic 54) REDACTED:1648 — Model.aresponse_stream has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentOS.__init__ (cyclomatic 54) · ×1
  • AgentOS.__init__ (cyclomatic 54) libs/agno/agno/os/app.py:314 — AgentOS.__init__ has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._arun_stream (cyclomatic 54) · ×1
  • _run._arun_stream (cyclomatic 54) libs/agno/agno/team/_run.py:3616 — _run._arun_stream has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _storage.from_dict (cyclomatic 53) · ×1
  • _storage.from_dict (cyclomatic 53) libs/agno/agno/agent/_storage.py:1226 — _storage.from_dict has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model.response_stream (cyclomatic 53) · ×1
  • Model.response_stream (cyclomatic 53) REDACTED:1367 — Model.response_stream has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.get_system_message (cyclomatic 53) · ×1
  • _messages.get_system_message (cyclomatic 53) libs/agno/agno/team/_messages.py:426 — _messages.get_system_message has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Loop.execute_stream (cyclomatic 53) · ×1
  • Loop.execute_stream (cyclomatic 53) libs/agno/agno/workflow/loop.py:583 — Loop.execute_stream has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Loop.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Loop.aexecute_stream (cyclomatic 53) · ×1
  • Loop.aexecute_stream (cyclomatic 53) libs/agno/agno/workflow/loop.py:980 — Loop.aexecute_stream has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Loop.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Claude._parse_provider_response_delta (cyclomatic 52) · ×1
  • Claude._parse_provider_response_delta (cyclomatic 52) libs/agno/agno/models/anthropic/claude.py:1114 — Claude._parse_provider_response_delta has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model.response (cyclomatic 52) · ×1
  • Model.response (cyclomatic 52) REDACTED:651 — Model.response has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Model.aresponse) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Model.aresponse (cyclomatic 52) · ×1
  • Model.aresponse (cyclomatic 52) REDACTED:884 — Model.aresponse has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Model.response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Gemini._parse_provider_response_delta (cyclomatic 52) · ×1
  • Gemini._parse_provider_response_delta (cyclomatic 52) libs/agno/agno/models/google/gemini.py:1399 — Gemini._parse_provider_response_delta has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._run_tasks_stream (cyclomatic 52) · ×1
  • _run._run_tasks_stream (cyclomatic 52) libs/agno/agno/team/_run.py:575 — _run._run_tasks_stream has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DbCluster._update (cyclomatic 52) · ×1
  • DbCluster._update (cyclomatic 52) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:621 — DbCluster._update has cyclomatic complexity 52 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · router.handle_workflow_via_websocket (cyclomatic 51) · ×1
  • router.handle_workflow_via_websocket (cyclomatic 51) libs/agno/agno/os/routers/workflows/router.py:269 — router.handle_workflow_via_websocket has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.get_request_kwargs (cyclomatic 51) · ×1
  • utils.get_request_kwargs (cyclomatic 51) libs/agno/agno/os/utils.py:141 — utils.get_request_kwargs has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Gemini._format_messages (cyclomatic 50) · ×1
  • Gemini._format_messages (cyclomatic 50) libs/agno/agno/models/google/gemini.py:778 — Gemini._format_messages has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · router.handle_workflow_continue_via_websocket (cyclomatic 50) · ×1
  • router.handle_workflow_continue_via_websocket (cyclomatic 50) libs/agno/agno/os/routers/workflows/router.py:842 — router.handle_workflow_continue_via_websocket has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AwsResources.create_resources (cyclomatic 50) · ×1
  • AwsResources.create_resources (cyclomatic 50) libs/agno_infra/agno/aws/resources.py:73 — AwsResources.create_resources has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run.continue_run_dispatch (cyclomatic 49) · ×1
  • _run.continue_run_dispatch (cyclomatic 49) libs/agno/agno/agent/_run.py:3285 — _run.continue_run_dispatch has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GoogleToolkit._resolve_creds (cyclomatic 49) · ×1
  • GoogleToolkit._resolve_creds (cyclomatic 49) libs/agno/agno/tools/google/base.py:173 — GoogleToolkit._resolve_creds has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DockerResources.create_resources (cyclomatic 49) · ×1
  • DockerResources.create_resources (cyclomatic 49) libs/agno_infra/agno/docker/resources.py:31 — DockerResources.create_resources has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · diagnostics._check (cyclomatic 48) · ×1
  • diagnostics._check (cyclomatic 48) libs/agno/agno/os/diagnostics.py:168 — diagnostics._check has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseExternalAgent._arun_stream (cyclomatic 47) · ×1
  • BaseExternalAgent._arun_stream (cyclomatic 47) libs/agno/agno/agents/base.py:1869 — BaseExternalAgent._arun_stream has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentResponse.from_agent (cyclomatic 47) · ×1
  • AgentResponse.from_agent (cyclomatic 47) libs/agno/agno/os/routers/agents/schema.py:73 — AgentResponse.from_agent has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ReasoningManager.stream_native_reasoning (cyclomatic 47) · ×1
  • ReasoningManager.stream_native_reasoning (cyclomatic 47) libs/agno/agno/reasoning/manager.py:379 — ReasoningManager.stream_native_reasoning has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ReasoningManager.astream_native_reasoning) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ReasoningManager.astream_native_reasoning (cyclomatic 47) · ×1
  • ReasoningManager.astream_native_reasoning (cyclomatic 47) libs/agno/agno/reasoning/manager.py:619 — ReasoningManager.astream_native_reasoning has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ReasoningManager.stream_native_reasoning) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · connect._connect_one (cyclomatic 47) · ×1
  • connect._connect_one (cyclomatic 47) libs/agnoctl/agnoctl/commands/connect.py:711 — connect._connect_one has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._aload_from_url (cyclomatic 46) · ×1
  • Knowledge._aload_from_url (cyclomatic 46) libs/agno/agno/knowledge/knowledge.py:2544 — Knowledge._aload_from_url has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._load_from_url) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._load_from_url (cyclomatic 46) · ×1
  • Knowledge._load_from_url (cyclomatic 46) libs/agno/agno/knowledge/knowledge.py:2733 — Knowledge._load_from_url has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._aload_from_url) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · PageCoordinator.sync (cyclomatic 46) · ×1
  • PageCoordinator.sync (cyclomatic 46) REDACTED:1404 — PageCoordinator.sync has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Claude._parse_provider_response (cyclomatic 46) · ×1
  • Claude._parse_provider_response (cyclomatic 46) libs/agno/agno/models/anthropic/claude.py:968 — Claude._parse_provider_response has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gemini.convert_schema (cyclomatic 46) · ×1
  • gemini.convert_schema (cyclomatic 46) libs/agno/agno/utils/gemini.py:223 — gemini.convert_schema has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AwsResources.delete_resources (cyclomatic 46) · ×1
  • AwsResources.delete_resources (cyclomatic 46) libs/agno_infra/agno/aws/resources.py:236 — AwsResources.delete_resources has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexAgent._translate_notification (cyclomatic 45) · ×1
  • CodexAgent._translate_notification (cyclomatic 45) libs/agno/agno/agents/codex/agent.py:974 — CodexAgent._translate_notification has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_sessions (cyclomatic 45) · ×1
  • DynamoDb.get_sessions (cyclomatic 45) libs/agno/agno/db/dynamo/dynamo.py:746 — DynamoDb.get_sessions has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb._get_collection (cyclomatic 45) · ×1
  • AsyncMongoDb._get_collection (cyclomatic 45) libs/agno/agno/db/mongo/async_mongo.py:381 — AsyncMongoDb._get_collection has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TeamSession.get_messages (cyclomatic 45) · ×1
  • TeamSession.get_messages (cyclomatic 45) libs/agno/agno/session/team.py:130 — TeamSession.get_messages has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools._apply_component_fields (cyclomatic 45) · ×1
  • StudioTools._apply_component_fields (cyclomatic 45) libs/agno/agno/tools/studio.py:2138 — StudioTools._apply_component_fields has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent.print_response_stream (cyclomatic 45) · ×1
  • agent.print_response_stream (cyclomatic 45) libs/agno/agno/utils/print_response/agent.py:28 — agent.print_response_stream has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · trace_to_database.run_trace_demo (cyclomatic 45) · ×1
  • trace_to_database.run_trace_demo (cyclomatic 45) cookbook/observability/trace_to_database.py:43 — trace_to_database.run_trace_demo has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.get_user_message (cyclomatic 44) · ×1
  • _messages.get_user_message (cyclomatic 44) libs/agno/agno/agent/_messages.py:1525 — _messages.get_user_message has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages.aget_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _messages.aget_user_message (cyclomatic 44) · ×1
  • _messages.aget_user_message (cyclomatic 44) libs/agno/agno/agent/_messages.py:1695 — _messages.aget_user_message has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages.get_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _tools.parse_tools (cyclomatic 44) · ×1
  • _tools.parse_tools (cyclomatic 44) libs/agno/agno/agent/_tools.py:473 — _tools.parse_tools has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb._create_table (cyclomatic 44) · ×1
  • SqliteDb._create_table (cyclomatic 44) REDACTED:379 — SqliteDb._create_table has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiInteractions._get_request_kwargs (cyclomatic 44) · ×1
  • GeminiInteractions._get_request_kwargs (cyclomatic 44) libs/agno/agno/models/google/gemini_interactions.py:452 — GeminiInteractions._get_request_kwargs has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunOutput.to_dict (cyclomatic 44) · ×1
  • RunOutput.to_dict (cyclomatic 44) libs/agno/agno/run/agent.py:781 — RunOutput.to_dict has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunRequirement.from_dict (cyclomatic 44) · ×1
  • RunRequirement.from_dict (cyclomatic 44) libs/agno/agno/run/requirement.py:232 — RunRequirement.from_dict has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GmailTools.__init__ (cyclomatic 44) · ×1
  • GmailTools.__init__ (cyclomatic 44) libs/agno/agno/tools/google/gmail.py:142 — GmailTools.__init__ has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · agent.aprint_response_stream (cyclomatic 44) · ×1
  • agent.aprint_response_stream (cyclomatic 44) libs/agno/agno/utils/print_response/agent.py:235 — agent.aprint_response_stream has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AwsResources.update_resources (cyclomatic 44) · ×1
  • AwsResources.update_resources (cyclomatic 44) libs/agno_infra/agno/aws/resources.py:391 — AwsResources.update_resources has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DockerResources.delete_resources (cyclomatic 44) · ×1
  • DockerResources.delete_resources (cyclomatic 44) libs/agno_infra/agno/docker/resources.py:191 — DockerResources.delete_resources has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReliabilityEval._evaluate (cyclomatic 43) · ×1
  • ReliabilityEval._evaluate (cyclomatic 43) libs/agno/agno/eval/reliability.py:119 — ReliabilityEval._evaluate has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._run_stream (cyclomatic 43) · ×1
  • _run._run_stream (cyclomatic 43) libs/agno/agno/team/_run.py:1442 — _run._run_stream has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · function._derive_entrypoint_schema (cyclomatic 43) · ×1
  • function._derive_entrypoint_schema (cyclomatic 43) libs/agno/agno/tools/function.py:586 — function._derive_entrypoint_schema has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DockerResources.update_resources (cyclomatic 43) · ×1
  • DockerResources.update_resources (cyclomatic 43) libs/agno_infra/agno/docker/resources.py:355 — DockerResources.update_resources has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · connect._report (cyclomatic 43) · ×1
  • connect._report (cyclomatic 43) libs/agnoctl/agnoctl/commands/connect.py:868 — connect._report has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageCoordinator.search (cyclomatic 42) · ×1
  • PageCoordinator.search (cyclomatic 42) REDACTED:1145 — PageCoordinator.search has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SecurityGroup.add_inbound_rules (cyclomatic 42) · ×1
  • SecurityGroup.add_inbound_rules (cyclomatic 42) libs/agno_infra/agno/aws/resource/ec2/security_group.py:330 — SecurityGroup.add_inbound_rules has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._arun (cyclomatic 41) · ×1
  • _run._arun (cyclomatic 41) libs/agno/agno/agent/_run.py:1513 — _run._arun has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb._create_table (cyclomatic 41) · ×1
  • PostgresDb._create_table (cyclomatic 41) libs/agno/agno/db/postgres/postgres.py:382 — PostgresDb._create_table has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowRunOutput.to_dict (cyclomatic 41) · ×1
  • WorkflowRunOutput.to_dict (cyclomatic 41) libs/agno/agno/run/workflow.py:886 — WorkflowRunOutput.to_dict has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages._get_user_message (cyclomatic 41) · ×1
  • _messages._get_user_message (cyclomatic 41) libs/agno/agno/team/_messages.py:1213 — _messages._get_user_message has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages._aget_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _messages._aget_user_message (cyclomatic 41) · ×1
  • _messages._aget_user_message (cyclomatic 41) libs/agno/agno/team/_messages.py:1372 — _messages._aget_user_message has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages._get_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · PostgresDb.upsert_sessions (cyclomatic 40) · ×1
  • PostgresDb.upsert_sessions (cyclomatic 40) libs/agno/agno/db/postgres/postgres.py:2158 — PostgresDb.upsert_sessions has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.upsert_sessions (cyclomatic 40) · ×1
  • ValkeyDb.upsert_sessions (cyclomatic 40) libs/agno/agno/db/valkey/valkey.py:1102 — ValkeyDb.upsert_sessions has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Gemini.get_request_params (cyclomatic 40) · ×1
  • Gemini.get_request_params (cyclomatic 40) libs/agno/agno/models/google/gemini.py:287 — Gemini.get_request_params has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TeamRunOutput.to_dict (cyclomatic 40) · ×1
  • TeamRunOutput.to_dict (cyclomatic 40) libs/agno/agno/run/team.py:871 — TeamRunOutput.to_dict has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._arun_tasks (cyclomatic 40) · ×1
  • _run._arun_tasks (cyclomatic 40) libs/agno/agno/team/_run.py:2117 — _run._arun_tasks has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent.build_panels (cyclomatic 40) · ×1
  • agent.build_panels (cyclomatic 40) libs/agno/agno/utils/print_response/agent.py:794 — agent.build_panels has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EcsContainer.get_container_definition (cyclomatic 40) · ×1
  • EcsContainer.get_container_definition (cyclomatic 40) libs/agno_infra/agno/aws/resource/ecs/container.py:93 — EcsContainer.get_container_definition has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _messages.get_run_messages (cyclomatic 39) · ×1
  • _messages.get_run_messages (cyclomatic 39) libs/agno/agno/agent/_messages.py:1879 — _messages.get_run_messages has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages.aget_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _messages.aget_run_messages (cyclomatic 39) · ×1
  • _messages.aget_run_messages (cyclomatic 39) libs/agno/agno/agent/_messages.py:2094 — _messages.aget_run_messages has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages.get_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · mdx._render (cyclomatic 39) · ×1
  • mdx._render (cyclomatic 39) libs/agno/agno/knowledge/reader/utils/mdx.py:101 — mdx._render has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIResponses._format_messages (cyclomatic 39) · ×1
  • OpenAIResponses._format_messages (cyclomatic 39) libs/agno/agno/models/openai/responses.py:663 — OpenAIResponses._format_messages has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SuperserveTools.__init__ (cyclomatic 39) · ×1
  • SuperserveTools.__init__ (cyclomatic 39) libs/agno/agno/tools/superserve.py:62 — SuperserveTools.__init__ has cyclomatic complexity 39 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SecurityGroup.add_outbound_rules (cyclomatic 39) · ×1
  • SecurityGroup.add_outbound_rules (cyclomatic 39) libs/agno_infra/agno/aws/resource/ec2/security_group.py:465 — SecurityGroup.add_outbound_rules has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CacheCluster._create (cyclomatic 39) · ×1
  • CacheCluster._create (cyclomatic 39) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:131 — CacheCluster._create has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · infra_cli.up (cyclomatic 39) · ×1
  • infra_cli.up (cyclomatic 39) libs/agno_infra/agno/cli/infra_cli.py:81 — infra_cli.up has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (infra_cli.down) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · infra_cli.down (cyclomatic 39) · ×1
  • infra_cli.down (cyclomatic 39) libs/agno_infra/agno/cli/infra_cli.py:279 — infra_cli.down has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (infra_cli.up) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _run._continue_run_stream (cyclomatic 38) · ×1
  • _run._continue_run_stream (cyclomatic 38) libs/agno/agno/agent/_run.py:3876 — _run._continue_run_stream has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils._eval_filter_expr (cyclomatic 38) · ×1
  • utils._eval_filter_expr (cyclomatic 38) libs/agno/agno/db/valkey/utils.py:246 — utils._eval_filter_expr has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GoogleSlidesTools.__init__ (cyclomatic 38) · ×1
  • GoogleSlidesTools.__init__ (cyclomatic 38) libs/agno/agno/tools/google/slides.py:87 — GoogleSlidesTools.__init__ has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SlackTools.__init__ (cyclomatic 38) · ×1
  • SlackTools.__init__ (cyclomatic 38) libs/agno/agno/tools/slack.py:141 — SlackTools.__init__ has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools.__init__ (cyclomatic 38) · ×1
  • StudioTools.__init__ (cyclomatic 38) libs/agno/agno/tools/studio.py:271 — StudioTools.__init__ has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.execute_stream (cyclomatic 38) · ×1
  • Router.execute_stream (cyclomatic 38) libs/agno/agno/workflow/router.py:762 — Router.execute_stream has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Router.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Router.aexecute_stream (cyclomatic 38) · ×1
  • Router.aexecute_stream (cyclomatic 38) libs/agno/agno/workflow/router.py:1099 — Router.aexecute_stream has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Router.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · filters.from_dict (cyclomatic 37) · ×1
  • filters.from_dict (cyclomatic 37) libs/agno/agno/filters.py:397 — filters.from_dict has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model.run_function_call (cyclomatic 37) · ×1
  • Model.run_function_call (cyclomatic 37) REDACTED:2232 — Model.run_function_call has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._continue_run_stream (cyclomatic 37) · ×1
  • _run._continue_run_stream (cyclomatic 37) libs/agno/agno/team/_run.py:8365 — _run._continue_run_stream has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Parallel.execute_stream (cyclomatic 37) · ×1
  • Parallel.execute_stream (cyclomatic 37) libs/agno/agno/workflow/parallel.py:457 — Parallel.execute_stream has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EcsService._create (cyclomatic 37) · ×1
  • EcsService._create (cyclomatic 37) libs/agno_infra/agno/aws/resource/ecs/service.py:121 — EcsService._create has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DockerImage.build_image (cyclomatic 37) · ×1
  • DockerImage.build_image (cyclomatic 37) libs/agno_infra/agno/docker/resource/image.py:169 — DockerImage.build_image has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · disconnect._disconnect (cyclomatic 37) · ×1
  • disconnect._disconnect (cyclomatic 37) libs/agnoctl/agnoctl/commands/disconnect.py:108 — disconnect._disconnect has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._run (cyclomatic 36) · ×1
  • _run._run (cyclomatic 36) libs/agno/agno/agent/_run.py:367 — _run._run has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncSqliteDb.upsert_sessions (cyclomatic 36) · ×1
  • AsyncSqliteDb.upsert_sessions (cyclomatic 36) REDACTED:1806 — AsyncSqliteDb.upsert_sessions has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.upsert_sessions (cyclomatic 36) · ×1
  • SqliteDb.upsert_sessions (cyclomatic 36) REDACTED:2063 — SqliteDb.upsert_sessions has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._aload_url_page_groups (cyclomatic 36) · ×1
  • Knowledge._aload_url_page_groups (cyclomatic 36) libs/agno/agno/knowledge/knowledge.py:3382 — Knowledge._aload_url_page_groups has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._load_url_page_groups) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._load_url_page_groups (cyclomatic 36) · ×1
  • Knowledge._load_url_page_groups (cyclomatic 36) libs/agno/agno/knowledge/knowledge.py:3595 — Knowledge._load_url_page_groups has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._aload_url_page_groups) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AgentOS._populate_registry (cyclomatic 36) · ×1
  • AgentOS._populate_registry (cyclomatic 36) libs/agno/agno/os/app.py:1308 — AgentOS._populate_registry has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteDb.from_config (cyclomatic 36) · ×1
  • RemoteDb.from_config (cyclomatic 36) libs/agno/agno/remote/base.py:66 — RemoteDb.from_config has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScheduleExecutor.execute (cyclomatic 36) · ×1
  • ScheduleExecutor.execute (cyclomatic 36) libs/agno/agno/scheduler/executor.py:82 — ScheduleExecutor.execute has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentSession.get_messages (cyclomatic 36) · ×1
  • AgentSession.get_messages (cyclomatic 36) libs/agno/agno/session/agent.py:141 — AgentSession.get_messages has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · json_schema.get_json_schema_for_arg (cyclomatic 36) · ×1
  • json_schema.get_json_schema_for_arg (cyclomatic 36) libs/agno/agno/utils/json_schema.py:99 — json_schema.get_json_schema_for_arg has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · streamlit.session_selector_widget (cyclomatic 36) · ×1
  • streamlit.session_selector_widget (cyclomatic 36) libs/agno/agno/utils/streamlit.py:57 — streamlit.session_selector_widget has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model._populate_stream_data (cyclomatic 35) · ×1
  • Model._populate_stream_data (cyclomatic 35) REDACTED:1930 — Model._populate_stream_data has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentOS._auto_discover_databases (cyclomatic 35) · ×1
  • AgentOS._auto_discover_databases (cyclomatic 35) libs/agno/agno/os/app.py:2715 — AgentOS._auto_discover_databases has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MongoDb._get_collection (cyclomatic 34) · ×1
  • MongoDb._get_collection (cyclomatic 34) libs/agno/agno/db/mongo/mongo.py:185 — MongoDb._get_collection has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.delete_component (cyclomatic 34) · ×1
  • PostgresDb.delete_component (cyclomatic 34) libs/agno/agno/db/postgres/postgres.py:4734 — PostgresDb.delete_component has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.delete_component (cyclomatic 34) · ×1
  • SqliteDb.delete_component (cyclomatic 34) REDACTED:4576 — SqliteDb.delete_component has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runner._isolate_attempt (cyclomatic 34) · ×1
  • runner._isolate_attempt (cyclomatic 34) libs/agno/agno/environments/runner.py:765 — runner._isolate_attempt has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Function._build_from_callable (cyclomatic 34) · ×1
  • Function._build_from_callable (cyclomatic 34) libs/agno/agno/tools/function.py:1473 — Function._build_from_callable has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FunctionCall._aexecute (cyclomatic 34) · ×1
  • FunctionCall._aexecute (cyclomatic 34) libs/agno/agno/tools/function.py:2889 — FunctionCall._aexecute has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _CompanyScheduleExecutor.execute (cyclomatic 33) · ×1
  • _CompanyScheduleExecutor.execute (cyclomatic 33) libs/agno/agno/company/routines.py:510 — _CompanyScheduleExecutor.execute has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb.upsert_sessions (cyclomatic 33) · ×1
  • AsyncMongoDb.upsert_sessions (cyclomatic 33) libs/agno/agno/db/mongo/async_mongo.py:1260 — AsyncMongoDb.upsert_sessions has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MongoDb.upsert_sessions (cyclomatic 33) · ×1
  • MongoDb.upsert_sessions (cyclomatic 33) libs/agno/agno/db/mongo/mongo.py:1069 — MongoDb.upsert_sessions has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMySQLDb.upsert_sessions (cyclomatic 33) · ×1
  • AsyncMySQLDb.upsert_sessions (cyclomatic 33) libs/agno/agno/db/mysql/async_mysql.py:1323 — AsyncMySQLDb.upsert_sessions has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MySQLDb.upsert_sessions (cyclomatic 33) · ×1
  • MySQLDb.upsert_sessions (cyclomatic 33) libs/agno/agno/db/mysql/mysql.py:1308 — MySQLDb.upsert_sessions has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · suite._run_case_body (cyclomatic 33) · ×1
  • suite._run_case_body (cyclomatic 33) libs/agno/agno/eval/suite.py:353 — suite._run_case_body has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIResponses._parse_provider_response_delta (cyclomatic 33) · ×1
  • OpenAIResponses._parse_provider_response_delta (cyclomatic 33) libs/agno/agno/models/openai/responses.py:1432 — OpenAIResponses._parse_provider_response_delta has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._run_tasks (cyclomatic 33) · ×1
  • _run._run_tasks (cyclomatic 33) libs/agno/agno/team/_run.py:236 — _run._run_tasks has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MCPTools.__init__ (cyclomatic 33) · ×1
  • MCPTools.__init__ (cyclomatic 33) libs/agno/agno/tools/mcp/mcp.py:253 — MCPTools.__init__ has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TelegramTools.__init__ (cyclomatic 33) · ×1
  • TelegramTools.__init__ (cyclomatic 33) libs/agno/agno/tools/telegram.py:41 — TelegramTools.__init__ has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · message.reformat_tool_call_ids (cyclomatic 33) · ×1
  • message.reformat_tool_call_ids (cyclomatic 33) libs/agno/agno/utils/message.py:203 — message.reformat_tool_call_ids has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChromaDb._build_search_results (cyclomatic 33) · ×1
  • ChromaDb._build_search_results (cyclomatic 33) REDACTED:1213 — ChromaDb._build_search_results has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Steps.execute_stream (cyclomatic 33) · ×1
  • Steps.execute_stream (cyclomatic 33) libs/agno/agno/workflow/steps.py:375 — Steps.execute_stream has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Steps.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Steps.aexecute_stream (cyclomatic 33) · ×1
  • Steps.aexecute_stream (cyclomatic 33) libs/agno/agno/workflow/steps.py:680 — Steps.aexecute_stream has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Steps.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AwsApp.build_resources (cyclomatic 33) · ×1
  • AwsApp.build_resources (cyclomatic 33) libs/agno_infra/agno/aws/app/base.py:614 — AwsApp.build_resources has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseDb.__init__ (cyclomatic 32) · ×1
  • BaseDb.__init__ (cyclomatic 32) libs/agno/agno/db/base.py:305 — BaseDb.__init__ has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GcsJsonDb.get_sessions (cyclomatic 32) · ×1
  • GcsJsonDb.get_sessions (cyclomatic 32) libs/agno/agno/db/gcs_json/gcs_json_db.py:544 — GcsJsonDb.get_sessions has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InMemoryDb.get_sessions (cyclomatic 32) · ×1
  • InMemoryDb.get_sessions (cyclomatic 32) libs/agno/agno/db/in_memory/in_memory_db.py:223 — InMemoryDb.get_sessions has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.get_sessions (cyclomatic 32) · ×1
  • JsonDb.get_sessions (cyclomatic 32) libs/agno/agno/db/json/json_db.py:593 — JsonDb.get_sessions has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SingleStoreDb._create_table (cyclomatic 32) · ×1
  • SingleStoreDb._create_table (cyclomatic 32) libs/agno/agno/db/singlestore/singlestore.py:235 — SingleStoreDb._create_table has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._aprocess_lightrag_content (cyclomatic 32) · ×1
  • Knowledge._aprocess_lightrag_content (cyclomatic 32) libs/agno/agno/knowledge/knowledge.py:4931 — Knowledge._aprocess_lightrag_content has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._process_lightrag_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._process_lightrag_content (cyclomatic 32) · ×1
  • Knowledge._process_lightrag_content (cyclomatic 32) libs/agno/agno/knowledge/knowledge.py:5103 — Knowledge._process_lightrag_content has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._aprocess_lightrag_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · OpenAIChat._parse_provider_response (cyclomatic 32) · ×1
  • OpenAIChat._parse_provider_response (cyclomatic 32) libs/agno/agno/models/openai/chat.py:804 — OpenAIChat._parse_provider_response has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueWorker._persist_run_error_inner (cyclomatic 32) · ×1
  • QueueWorker._persist_run_error_inner (cyclomatic 32) libs/agno/agno/os/job_queue.py:1553 — QueueWorker._persist_run_error_inner has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · approval._build_approval_dict (cyclomatic 32) · ×1
  • approval._build_approval_dict (cyclomatic 32) libs/agno/agno/run/approval.py:117 — approval._build_approval_dict has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._arun (cyclomatic 32) · ×1
  • _run._arun (cyclomatic 32) libs/agno/agno/team/_run.py:3044 — _run._arun has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._backfill_approval_to_requirements (cyclomatic 32) · ×1
  • _run._backfill_approval_to_requirements (cyclomatic 32) libs/agno/agno/team/_run.py:5875 — _run._backfill_approval_to_requirements has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent.scrub_media_from_run_output (cyclomatic 32) · ×1
  • agent.scrub_media_from_run_output (cyclomatic 32) libs/agno/agno/utils/agent.py:454 — agent.scrub_media_from_run_output has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._deep_copy_single_step (cyclomatic 32) · ×1
  • Workflow._deep_copy_single_step (cyclomatic 32) libs/agno/agno/workflow/workflow.py:11791 — Workflow._deep_copy_single_step has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InfraApp.add_app_properties_to_resources (cyclomatic 32) · ×1
  • InfraApp.add_app_properties_to_resources (cyclomatic 32) libs/agno_infra/agno/base/app.py:115 — InfraApp.add_app_properties_to_resources has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.aget_relevant_docs_from_knowledge (cyclomatic 31) · ×1
  • _messages.aget_relevant_docs_from_knowledge (cyclomatic 31) libs/agno/agno/agent/_messages.py:2646 — _messages.aget_relevant_docs_from_knowledge has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClaudeAgent._build_continuation (cyclomatic 31) · ×1
  • ClaudeAgent._build_continuation (cyclomatic 31) libs/agno/agno/agents/claude/agent.py:728 — ClaudeAgent._build_continuation has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClaudeAgent._arun_adapter_stream (cyclomatic 31) · ×1
  • ClaudeAgent._arun_adapter_stream (cyclomatic 31) libs/agno/agno/agents/claude/agent.py:1138 — ClaudeAgent._arun_adapter_stream has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bootstrap.arehydrate_product (cyclomatic 31) · ×1
  • bootstrap.arehydrate_product (cyclomatic 31) libs/agno/agno/company/bootstrap.py:15 — bootstrap.arehydrate_product has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb._get_table (cyclomatic 31) · ×1
  • PostgresDb._get_table (cyclomatic 31) libs/agno/agno/db/postgres/postgres.py:631 — PostgresDb._get_table has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqliteDb._get_table (cyclomatic 31) · ×1
  • SqliteDb._get_table (cyclomatic 31) REDACTED:625 — SqliteDb._get_table has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · migrations.rekey_user_entity_learnings (cyclomatic 31) · ×1
  • migrations.rekey_user_entity_learnings (cyclomatic 31) libs/agno/agno/learn/migrations.py:285 — migrations.rekey_user_entity_learnings has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (migrations.arekey_user_entity_learnings) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · migrations.arekey_user_entity_learnings (cyclomatic 31) · ×1
  • migrations.arekey_user_entity_learnings (cyclomatic 31) libs/agno/agno/learn/migrations.py:454 — migrations.arekey_user_entity_learnings has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (migrations.rekey_user_entity_learnings) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AwsBedrock._format_messages (cyclomatic 31) · ×1
  • AwsBedrock._format_messages (cyclomatic 31) libs/agno/agno/models/aws/bedrock.py:334 — AwsBedrock._format_messages has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiteLLM._format_messages (cyclomatic 31) · ×1
  • LiteLLM._format_messages (cyclomatic 31) libs/agno/agno/models/litellm/chat.py:129 — LiteLLM._format_messages has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIChat._parse_provider_response_delta (cyclomatic 31) · ×1
  • OpenAIChat._parse_provider_response_delta (cyclomatic 31) libs/agno/agno/models/openai/chat.py:905 — OpenAIChat._parse_provider_response_delta has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedisEventStream.tail (cyclomatic 31) · ×1
  • RedisEventStream.tail (cyclomatic 31) libs/agno/agno/os/event_streams/redis.py:620 — RedisEventStream.tail has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseWorkflowRunOutputEvent.to_dict (cyclomatic 31) · ×1
  • BaseWorkflowRunOutputEvent.to_dict (cyclomatic 31) libs/agno/agno/run/workflow.py:103 — BaseWorkflowRunOutputEvent.to_dict has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Parallel.aexecute_stream (cyclomatic 31) · ×1
  • Parallel.aexecute_stream (cyclomatic 31) libs/agno/agno/workflow/parallel.py:823 — Parallel.aexecute_stream has cyclomatic complexity 31 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · _tools.aget_tools (cyclomatic 30) · ×1
  • _tools.aget_tools (cyclomatic 30) libs/agno/agno/agent/_tools.py:326 — _tools.aget_tools has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _CompanyScheduleExecutor._dispatch (cyclomatic 30) · ×1
  • _CompanyScheduleExecutor._dispatch (cyclomatic 30) libs/agno/agno/company/routines.py:939 — _CompanyScheduleExecutor._dispatch has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · filter_converter.filter_expr_to_sqlalchemy (cyclomatic 30) · ×1
  • filter_converter.filter_expr_to_sqlalchemy (cyclomatic 30) libs/agno/agno/db/filter_converter.py:63 — filter_converter.filter_expr_to_sqlalchemy has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GcsJsonDb.get_trace_stats (cyclomatic 30) · ×1
  • GcsJsonDb.get_trace_stats (cyclomatic 30) libs/agno/agno/db/gcs_json/gcs_json_db.py:1831 — GcsJsonDb.get_trace_stats has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sources.validate_source_fields (cyclomatic 30) · ×1
  • sources.validate_source_fields (cyclomatic 30) libs/agno/agno/db/schemas/sources.py:8 — sources.validate_source_fields has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncSqliteDb._create_table (cyclomatic 30) · ×1
  • AsyncSqliteDb._create_table (cyclomatic 30) REDACTED:328 — AsyncSqliteDb._create_table has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebsiteReader.crawl (cyclomatic 30) · ×1
  • WebsiteReader.crawl (cyclomatic 30) libs/agno/agno/knowledge/reader/website_reader.py:155 — WebsiteReader.crawl has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiInteractions._build_input (cyclomatic 30) · ×1
  • GeminiInteractions._build_input (cyclomatic 30) libs/agno/agno/models/google/gemini_interactions.py:351 — GeminiInteractions._build_input has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowSession.get_messages_from_team_runs (cyclomatic 30) · ×1
  • WorkflowSession.get_messages_from_team_runs (cyclomatic 30) libs/agno/agno/session/workflow.py:335 — WorkflowSession.get_messages_from_team_runs has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _default_tools.aget_relevant_docs_from_knowledge (cyclomatic 30) · ×1
  • _default_tools.aget_relevant_docs_from_knowledge (cyclomatic 30) libs/agno/agno/team/_default_tools.py:1866 — _default_tools.aget_relevant_docs_from_knowledge has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KernelSession._execute_locked (cyclomatic 30) · ×1
  • KernelSession._execute_locked (cyclomatic 30) libs/agno/agno/tools/code/kernel.py:612 — KernelSession._execute_locked has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SalesforceTools.__init__ (cyclomatic 30) · ×1
  • SalesforceTools.__init__ (cyclomatic 30) libs/agno/agno/tools/salesforce.py:50 — SalesforceTools.__init__ has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · 03_step_user_input_streaming.run_workflow_streaming (cyclomatic 30) · ×1
  • 03_step_user_input_streaming.run_workflow_streaming (cyclomatic 30) cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:168 — 03_step_user_input_streaming.run_workflow_streaming has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · A2AClient._parse_stream_event (cyclomatic 29) · ×1
  • A2AClient._parse_stream_event (cyclomatic 29) libs/agno/agno/client/a2a/client.py:231 — A2AClient._parse_stream_event has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncPostgresDb._create_table (cyclomatic 29) · ×1
  • AsyncPostgresDb._create_table (cyclomatic 29) libs/agno/agno/db/postgres/async_postgres.py:343 — AsyncPostgresDb._create_table has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.create_component_with_config (cyclomatic 29) · ×1
  • PostgresDb.create_component_with_config (cyclomatic 29) libs/agno/agno/db/postgres/postgres.py:5126 — PostgresDb.create_component_with_config has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.delete_config (cyclomatic 29) · ×1
  • PostgresDb.delete_config (cyclomatic 29) libs/agno/agno/db/postgres/postgres.py:5879 — PostgresDb.delete_config has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SingleStoreDb.upsert_sessions (cyclomatic 29) · ×1
  • SingleStoreDb.upsert_sessions (cyclomatic 29) libs/agno/agno/db/singlestore/singlestore.py:1367 — SingleStoreDb.upsert_sessions has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.create_component_with_config (cyclomatic 29) · ×1
  • SqliteDb.create_component_with_config (cyclomatic 29) REDACTED:4966 — SqliteDb.create_component_with_config has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.delete_config (cyclomatic 29) · ×1
  • SqliteDb.delete_config (cyclomatic 29) REDACTED:5668 — SqliteDb.delete_config has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge.aremove_content_by_id (cyclomatic 29) · ×1
  • Knowledge.aremove_content_by_id (cyclomatic 29) libs/agno/agno/knowledge/knowledge.py:1577 — Knowledge.aremove_content_by_id has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EntityMemoryStore._apply_remember (cyclomatic 29) · ×1
  • EntityMemoryStore._apply_remember (cyclomatic 29) libs/agno/agno/learn/stores/entity_memory.py:1561 — EntityMemoryStore._apply_remember has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunMetrics.__add__ (cyclomatic 29) · ×1
  • RunMetrics.__add__ (cyclomatic 29) libs/agno/agno/metrics.py:336 — RunMetrics.__add__ has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIResponses._parse_provider_response (cyclomatic 29) · ×1
  • OpenAIResponses._parse_provider_response (cyclomatic 29) libs/agno/agno/models/openai/responses.py:1336 — OpenAIResponses._parse_provider_response has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · input.extract_media (cyclomatic 29) · ×1
  • input.extract_media (cyclomatic 29) REDACTED:33 — input.extract_media has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandbox._sandbox_start_gate (cyclomatic 29) · ×1
  • sandbox._sandbox_start_gate (cyclomatic 29) libs/agno/agno/os/routers/company/sandbox.py:48 — sandbox._sandbox_start_gate has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._resolve_member_run_output_for_continue (cyclomatic 29) · ×1
  • _run._resolve_member_run_output_for_continue (cyclomatic 29) libs/agno/agno/team/_run.py:6188 — _run._resolve_member_run_output_for_continue has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedmineTools.__init__ (cyclomatic 29) · ×1
  • RedmineTools.__init__ (cyclomatic 29) libs/agno/agno/tools/redmine.py:15 — RedmineTools.__init__ has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · media_offload.iter_run_media (cyclomatic 29) · ×1
  • media_offload.iter_run_media (cyclomatic 29) libs/agno/agno/utils/media_offload.py:749 — media_offload.iter_run_media has cyclomatic complexity 29 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · message.get_text_from_message (cyclomatic 29) · ×1
  • message.get_text_from_message (cyclomatic 29) libs/agno/agno/utils/message.py:303 — message.get_text_from_message has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChromaDb._hybrid_search (cyclomatic 29) · ×1
  • ChromaDb._hybrid_search (cyclomatic 29) REDACTED:1021 — ChromaDb._hybrid_search has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Step._execute_nested_workflow_stream_inner (cyclomatic 29) · ×1
  • Step._execute_nested_workflow_stream_inner (cyclomatic 29) libs/agno/agno/workflow/step.py:3023 — Step._execute_nested_workflow_stream_inner has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Step._aexecute_nested_workflow_stream_inner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Step._aexecute_nested_workflow_stream_inner (cyclomatic 29) · ×1
  • Step._aexecute_nested_workflow_stream_inner (cyclomatic 29) libs/agno/agno/workflow/step.py:3301 — Step._aexecute_nested_workflow_stream_inner has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Step._execute_nested_workflow_stream_inner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · EcsService._update (cyclomatic 29) · ×1
  • EcsService._update (cyclomatic 29) libs/agno_infra/agno/aws/resource/ecs/service.py:335 — EcsService._update has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.get_traces (cyclomatic 28) · ×1
  • ValkeyDb.get_traces (cyclomatic 28) libs/agno/agno/db/valkey/valkey.py:2600 — ValkeyDb.get_traces has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge.remove_content_by_id (cyclomatic 28) · ×1
  • Knowledge.remove_content_by_id (cyclomatic 28) libs/agno/agno/knowledge/knowledge.py:1464 — Knowledge.remove_content_by_id has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._aload_dir_as_folder (cyclomatic 28) · ×1
  • Knowledge._aload_dir_as_folder (cyclomatic 28) libs/agno/agno/knowledge/knowledge.py:2970 — Knowledge._aload_dir_as_folder has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._load_dir_as_folder) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._load_dir_as_folder (cyclomatic 28) · ×1
  • Knowledge._load_dir_as_folder (cyclomatic 28) libs/agno/agno/knowledge/knowledge.py:3093 — Knowledge._load_dir_as_folder has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._aload_dir_as_folder) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · job_queue.acontinue_via_queue (cyclomatic 28) · ×1
  • job_queue.acontinue_via_queue (cyclomatic 28) libs/agno/agno/os/job_queue.py:2583 — job_queue.acontinue_via_queue has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · JWTValidator.validate_token (cyclomatic 28) · ×1
  • JWTValidator.validate_token (cyclomatic 28) libs/agno/agno/os/middleware/jwt.py:270 — JWTValidator.validate_token has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowSession.get_messages_from_agent_runs (cyclomatic 28) · ×1
  • WorkflowSession.get_messages_from_agent_runs (cyclomatic 28) libs/agno/agno/session/workflow.py:230 — WorkflowSession.get_messages_from_agent_runs has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._continue_run_dispatch_stream_with_member_events (cyclomatic 28) · ×1
  • _run._continue_run_dispatch_stream_with_member_events (cyclomatic 28) libs/agno/agno/team/_run.py:7967 — _run._continue_run_dispatch_stream_with_member_events has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Function.process_entrypoint (cyclomatic 28) · ×1
  • Function.process_entrypoint (cyclomatic 28) libs/agno/agno/tools/function.py:1624 — Function.process_entrypoint has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GithubTools.get_repository_with_stats (cyclomatic 28) · ×1
  • GithubTools.get_repository_with_stats (cyclomatic 28) libs/agno/agno/tools/github.py:994 — GithubTools.get_repository_with_stats has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools._curated_config_view (cyclomatic 28) · ×1
  • StudioTools._curated_config_view (cyclomatic 28) libs/agno/agno/tools/studio.py:1664 — StudioTools._curated_config_view has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.print_response (cyclomatic 28) · ×1
  • workflow.print_response (cyclomatic 28) libs/agno/agno/utils/print_response/workflow.py:44 — workflow.print_response has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (workflow.aprint_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · workflow.aprint_response (cyclomatic 28) · ×1
  • workflow.aprint_response (cyclomatic 28) libs/agno/agno/utils/print_response/workflow.py:905 — workflow.aprint_response has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (workflow.print_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ChromaDb._build_get_results (cyclomatic 28) · ×1
  • ChromaDb._build_get_results (cyclomatic 28) REDACTED:1311 — ChromaDb._build_get_results has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EmrCluster._create (cyclomatic 28) · ×1
  • EmrCluster._create (cyclomatic 28) libs/agno_infra/agno/aws/resource/emr/cluster.py:87 — EmrCluster._create has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · infra_cli.patch (cyclomatic 28) · ×1
  • infra_cli.patch (cyclomatic 28) libs/agno_infra/agno/cli/infra_cli.py:467 — infra_cli.patch has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages.get_relevant_docs_from_knowledge (cyclomatic 27) · ×1
  • _messages.get_relevant_docs_from_knowledge (cyclomatic 27) libs/agno/agno/agent/_messages.py:2523 — _messages.get_relevant_docs_from_knowledge has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routines._routine_failure (cyclomatic 27) · ×1
  • routines._routine_failure (cyclomatic 27) libs/agno/agno/company/routines.py:71 — routines._routine_failure has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_traces (cyclomatic 27) · ×1
  • DynamoDb.get_traces (cyclomatic 27) libs/agno/agno/db/dynamo/dynamo.py:2690 — DynamoDb.get_traces has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FirestoreDb.get_sessions (cyclomatic 27) · ×1
  • FirestoreDb.get_sessions (cyclomatic 27) libs/agno/agno/db/firestore/firestore.py:741 — FirestoreDb.get_sessions has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GcsJsonDb.get_eval_runs (cyclomatic 27) · ×1
  • GcsJsonDb.get_eval_runs (cyclomatic 27) libs/agno/agno/db/gcs_json/gcs_json_db.py:1480 — GcsJsonDb.get_eval_runs has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GcsJsonDb.get_traces (cyclomatic 27) · ×1
  • GcsJsonDb.get_traces (cyclomatic 27) libs/agno/agno/db/gcs_json/gcs_json_db.py:1738 — GcsJsonDb.get_traces has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InMemoryDb.get_eval_runs (cyclomatic 27) · ×1
  • InMemoryDb.get_eval_runs (cyclomatic 27) libs/agno/agno/db/in_memory/in_memory_db.py:1299 — InMemoryDb.get_eval_runs has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.get_eval_runs (cyclomatic 27) · ×1
  • JsonDb.get_eval_runs (cyclomatic 27) libs/agno/agno/db/json/json_db.py:1580 — JsonDb.get_eval_runs has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.get_traces (cyclomatic 27) · ×1
  • JsonDb.get_traces (cyclomatic 27) libs/agno/agno/db/json/json_db.py:1838 — JsonDb.get_traces has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.upsert_memories (cyclomatic 27) · ×1
  • ValkeyDb.upsert_memories (cyclomatic 27) libs/agno/agno/db/valkey/valkey.py:1604 — ValkeyDb.upsert_memories has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.get_eval_runs (cyclomatic 27) · ×1
  • ValkeyDb.get_eval_runs (cyclomatic 27) libs/agno/agno/db/valkey/valkey.py:2254 — ValkeyDb.get_eval_runs has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AccuracyEval.run (cyclomatic 27) · ×1
  • AccuracyEval.run (cyclomatic 27) libs/agno/agno/eval/accuracy.py:359 — AccuracyEval.run has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._aload_from_content (cyclomatic 27) · ×1
  • Knowledge._aload_from_content (cyclomatic 27) libs/agno/agno/knowledge/knowledge.py:3786 — Knowledge._aload_from_content has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._load_from_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._load_from_content (cyclomatic 27) · ×1
  • Knowledge._load_from_content (cyclomatic 27) libs/agno/agno/knowledge/knowledge.py:3898 — Knowledge._load_from_content has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._aload_from_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · PageSource.fetch (cyclomatic 27) · ×1
  • PageSource.fetch (cyclomatic 27) libs/agno/agno/knowledge/page/_source.py:131 — PageSource.fetch has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DoclingReader.read (cyclomatic 27) · ×1
  • DoclingReader.read (cyclomatic 27) libs/agno/agno/knowledge/reader/docling_reader.py:223 — DoclingReader.read has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WebsiteReader.async_crawl (cyclomatic 27) · ×1
  • WebsiteReader.async_crawl (cyclomatic 27) libs/agno/agno/knowledge/reader/website_reader.py:290 — WebsiteReader.async_crawl has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Gemini._format_file_for_message (cyclomatic 27) · ×1
  • Gemini._format_file_for_message (cyclomatic 27) libs/agno/agno/models/google/gemini.py:1140 — Gemini._format_file_for_message has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp._register_exposed_components (cyclomatic 27) · ×1
  • mcp._register_exposed_components (cyclomatic 27) libs/agno/agno/os/mcp.py:1934 — mcp._register_exposed_components has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PublicMiddleware._validate_form (cyclomatic 27) · ×1
  • PublicMiddleware._validate_form (cyclomatic 27) libs/agno/agno/os/public/_middleware.py:122 — PublicMiddleware._validate_form has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BaseRunOutputEvent.from_dict (cyclomatic 27) · ×1
  • BaseRunOutputEvent.from_dict (cyclomatic 27) libs/agno/agno/run/base.py:253 — BaseRunOutputEvent.from_dict has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _response._update_run_response (cyclomatic 27) · ×1
  • _response._update_run_response (cyclomatic 27) libs/agno/agno/team/_response.py:903 — _response._update_run_response has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _response._ahandle_model_response_stream (cyclomatic 27) · ×1
  • _response._ahandle_model_response_stream (cyclomatic 27) libs/agno/agno/team/_response.py:1148 — _response._ahandle_model_response_stream has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _response._convert_response_to_structured_format (cyclomatic 27) · ×1
  • _response._convert_response_to_structured_format (cyclomatic 27) libs/agno/agno/team/_response.py:1671 — _response._convert_response_to_structured_format has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run.acontinue_run_dispatch (cyclomatic 27) · ×1
  • _run.acontinue_run_dispatch (cyclomatic 27) libs/agno/agno/team/_run.py:9127 — _run.acontinue_run_dispatch has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · agentos._normalize_eval_run (cyclomatic 27) · ×1
  • agentos._normalize_eval_run (cyclomatic 27) libs/agno/agno/tools/agentos.py:835 — agentos._normalize_eval_run has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FunctionCall._execute (cyclomatic 27) · ×1
  • FunctionCall._execute (cyclomatic 27) libs/agno/agno/tools/function.py:2611 — FunctionCall._execute has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PubmedTools.parse_details (cyclomatic 27) · ×1
  • PubmedTools.parse_details (cyclomatic 27) libs/agno/agno/tools/pubmed.py:53 — PubmedTools.parse_details has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _media.stage_media (cyclomatic 26) · ×1
  • _media.stage_media (cyclomatic 26) libs/agno/agno/agents/_media.py:152 — _media.stage_media has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.filter_expr_to_clickhouse (cyclomatic 26) · ×1
  • utils.filter_expr_to_clickhouse (cyclomatic 26) libs/agno/agno/db/clickhouse/utils.py:175 — utils.filter_expr_to_clickhouse has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_trace_stats (cyclomatic 26) · ×1
  • DynamoDb.get_trace_stats (cyclomatic 26) libs/agno/agno/db/dynamo/dynamo.py:2857 — DynamoDb.get_trace_stats has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.get_trace_stats (cyclomatic 26) · ×1
  • JsonDb.get_trace_stats (cyclomatic 26) libs/agno/agno/db/json/json_db.py:1931 — JsonDb.get_trace_stats has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncPostgresDb._get_table (cyclomatic 26) · ×1
  • AsyncPostgresDb._get_table (cyclomatic 26) libs/agno/agno/db/postgres/async_postgres.py:503 — AsyncPostgresDb._get_table has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_sessions (cyclomatic 26) · ×1
  • AsyncPostgresDb.get_sessions (cyclomatic 26) libs/agno/agno/db/postgres/async_postgres.py:1612 — AsyncPostgresDb.get_sessions has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RedisDb.get_traces (cyclomatic 26) · ×1
  • RedisDb.get_traces (cyclomatic 26) libs/agno/agno/db/redis/redis.py:2122 — RedisDb.get_traces has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_sessions (cyclomatic 26) · ×1
  • AsyncSqliteDb.get_sessions (cyclomatic 26) REDACTED:1542 — AsyncSqliteDb.get_sessions has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqliteDb.get_sessions (cyclomatic 26) · ×1
  • SqliteDb.get_sessions (cyclomatic 26) REDACTED:1799 — SqliteDb.get_sessions has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runner.arun_rollouts (cyclomatic 26) · ×1
  • runner.arun_rollouts (cyclomatic 26) libs/agno/agno/environments/runner.py:947 — runner.arun_rollouts has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AccuracyEval.arun (cyclomatic 26) · ×1
  • AccuracyEval.arun (cyclomatic 26) libs/agno/agno/eval/accuracy.py:504 — AccuracyEval.arun has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model.run_function_calls (cyclomatic 26) · ×1
  • Model.run_function_calls (cyclomatic 26) REDACTED:2416 — Model.run_function_calls has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentOS._initialize_agents (cyclomatic 26) · ×1
  • AgentOS._initialize_agents (cyclomatic 26) libs/agno/agno/os/app.py:1197 — AgentOS._initialize_agents has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MCPRoutingMiddleware.__call__ (cyclomatic 26) · ×1
  • MCPRoutingMiddleware.__call__ (cyclomatic 26) libs/agno/agno/os/middleware/mcp_routing.py:45 — MCPRoutingMiddleware.__call__ has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · router.handle_workflow_subscription (cyclomatic 26) · ×1
  • router.handle_workflow_subscription (cyclomatic 26) libs/agno/agno/os/routers/workflows/router.py:599 — router.handle_workflow_subscription has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.collect_mcp_tools_from_workflow_step (cyclomatic 26) · ×1
  • utils.collect_mcp_tools_from_workflow_step (cyclomatic 26) libs/agno/agno/os/utils.py:2380 — utils.collect_mcp_tools_from_workflow_step has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowRunOutput.from_dict (cyclomatic 26) · ×1
  • WorkflowRunOutput.from_dict (cyclomatic 26) libs/agno/agno/run/workflow.py:1002 — WorkflowRunOutput.from_dict has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _default_tools.get_relevant_docs_from_knowledge (cyclomatic 26) · ×1
  • _default_tools.get_relevant_docs_from_knowledge (cyclomatic 26) libs/agno/agno/team/_default_tools.py:1763 — _default_tools.get_relevant_docs_from_knowledge has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages._build_trailing_sections (cyclomatic 26) · ×1
  • _messages._build_trailing_sections (cyclomatic 26) libs/agno/agno/team/_messages.py:346 — _messages._build_trailing_sections has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _response._handle_model_response_stream (cyclomatic 26) · ×1
  • _response._handle_model_response_stream (cyclomatic 26) libs/agno/agno/team/_response.py:987 — _response._handle_model_response_stream has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._run (cyclomatic 26) · ×1
  • _run._run (cyclomatic 26) libs/agno/agno/team/_run.py:1082 — _run._run has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileGenerationTools.__init__ (cyclomatic 26) · ×1
  • FileGenerationTools.__init__ (cyclomatic 26) libs/agno/agno/tools/file/generation.py:96 — FileGenerationTools.__init__ has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · StudioTools._bind_child_to_target_db (cyclomatic 26) · ×1
  • StudioTools._bind_child_to_target_db (cyclomatic 26) libs/agno/agno/tools/studio.py:4853 — StudioTools._bind_child_to_target_db has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · YouTools._format_results (cyclomatic 26) · ×1
  • YouTools._format_results (cyclomatic 26) libs/agno/agno/tools/youcom.py:180 — YouTools._format_results has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow.arun (cyclomatic 26) · ×1
  • Workflow.arun (cyclomatic 26) libs/agno/agno/workflow/workflow.py:10801 — Workflow.arun has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BaseExternalAgent._arun_non_stream (cyclomatic 25) · ×1
  • BaseExternalAgent._arun_non_stream (cyclomatic 25) libs/agno/agno/agents/base.py:1772 — BaseExternalAgent._arun_non_stream has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Compaction.__post_init__ (cyclomatic 25) · ×1
  • Compaction.__post_init__ (cyclomatic 25) libs/agno/agno/compaction/compaction.py:158 — Compaction.__post_init__ has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · refresh.arefresh_product (cyclomatic 25) · ×1
  • refresh.arefresh_product (cyclomatic 25) libs/agno/agno/company/refresh.py:54 — refresh.arefresh_product has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncBaseDb.__init__ (cyclomatic 25) · ×1
  • AsyncBaseDb.__init__ (cyclomatic 25) libs/agno/agno/db/base.py:2644 — AsyncBaseDb.__init__ has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FirestoreDb.get_eval_runs (cyclomatic 25) · ×1
  • FirestoreDb.get_eval_runs (cyclomatic 25) libs/agno/agno/db/firestore/firestore.py:2032 — FirestoreDb.get_eval_runs has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb.get_sessions (cyclomatic 25) · ×1
  • AsyncMongoDb.get_sessions (cyclomatic 25) libs/agno/agno/db/mongo/async_mongo.py:969 — AsyncMongoDb.get_sessions has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MongoDb.get_sessions (cyclomatic 25) · ×1
  • MongoDb.get_sessions (cyclomatic 25) libs/agno/agno/db/mongo/mongo.py:779 — MongoDb.get_sessions has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.get_sessions (cyclomatic 25) · ×1
  • PostgresDb.get_sessions (cyclomatic 25) libs/agno/agno/db/postgres/postgres.py:1843 — PostgresDb.get_sessions has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RedisDb.get_eval_runs (cyclomatic 25) · ×1
  • RedisDb.get_eval_runs (cyclomatic 25) libs/agno/agno/db/redis/redis.py:1824 — RedisDb.get_eval_runs has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.upsert_component (cyclomatic 25) · ×1
  • SqliteDb.upsert_component (cyclomatic 25) REDACTED:4412 — SqliteDb.upsert_component has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.deserialize_session_json_fields (cyclomatic 25) · ×1
  • utils.deserialize_session_json_fields (cyclomatic 25) REDACTED:969 — utils.deserialize_session_json_fields has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ValkeyDb.get_trace_stats (cyclomatic 25) · ×1
  • ValkeyDb.get_trace_stats (cyclomatic 25) libs/agno/agno/db/valkey/valkey.py:2701 — ValkeyDb.get_trace_stats has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EntityMemory.get_context_text (cyclomatic 25) · ×1
  • EntityMemory.get_context_text (cyclomatic 25) libs/agno/agno/learn/schemas.py:815 — EntityMemory.get_context_text has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EntityMemoryStore._format_entity_hit (cyclomatic 25) · ×1
  • EntityMemoryStore._format_entity_hit (cyclomatic 25) libs/agno/agno/learn/stores/entity_memory.py:2000 — EntityMemoryStore._format_entity_hit has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model._populate_assistant_message (cyclomatic 25) · ×1
  • Model._populate_assistant_message (cyclomatic 25) REDACTED:1247 — Model._populate_assistant_message has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIResponses.get_request_params (cyclomatic 25) · ×1
  • OpenAIResponses.get_request_params (cyclomatic 25) libs/agno/agno/models/openai/responses.py:336 — OpenAIResponses.get_request_params has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.map_run_output_to_a2a_task (cyclomatic 25) · ×1
  • utils.map_run_output_to_a2a_task (cyclomatic 25) libs/agno/agno/os/interfaces/a2a/utils.py:195 — utils.map_run_output_to_a2a_task has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · helpers.upload_and_send_media_async (cyclomatic 25) · ×1
  • helpers.upload_and_send_media_async (cyclomatic 25) libs/agno/agno/os/interfaces/whatsapp/helpers.py:359 — helpers.upload_and_send_media_async has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._merge_requirement_decision (cyclomatic 25) · ×1
  • _run._merge_requirement_decision (cyclomatic 25) libs/agno/agno/team/_run.py:5786 — _run._merge_requirement_decision has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._route_requirements_to_members_stream (cyclomatic 25) · ×1
  • _run._route_requirements_to_members_stream (cyclomatic 25) libs/agno/agno/team/_run.py:6469 — _run._route_requirements_to_members_stream has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_run._aroute_requirements_to_members_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _run._aroute_requirements_to_members_stream (cyclomatic 25) · ×1
  • _run._aroute_requirements_to_members_stream (cyclomatic 25) libs/agno/agno/team/_run.py:6666 — _run._aroute_requirements_to_members_stream has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_run._route_requirements_to_members_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ParallelTools.parallel_extract (cyclomatic 25) · ×1
  • ParallelTools.parallel_extract (cyclomatic 25) libs/agno/agno/tools/parallel.py:227 — ParallelTools.parallel_extract has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools._step_config_to_spec (cyclomatic 25) · ×1
  • StudioTools._step_config_to_spec (cyclomatic 25) libs/agno/agno/tools/studio.py:1612 — StudioTools._step_config_to_spec has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools.get_component (cyclomatic 25) · ×1
  • StudioTools.get_component (cyclomatic 25) libs/agno/agno/tools/studio.py:1987 — StudioTools.get_component has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · claude._format_file_for_message (cyclomatic 25) · ×1
  • claude._format_file_for_message (cyclomatic 25) libs/agno/agno/utils/models/claude.py:363 — claude._format_file_for_message has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent.build_panels_stream (cyclomatic 25) · ×1
  • agent.build_panels_stream (cyclomatic 25) libs/agno/agno/utils/print_response/agent.py:442 — agent.build_panels_stream has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UpstashVectorDb.async_upsert (cyclomatic 25) · ×1
  • UpstashVectorDb.async_upsert (cyclomatic 25) REDACTED:623 — UpstashVectorDb.async_upsert has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EcsTaskDefinition._create (cyclomatic 25) · ×1
  • EcsTaskDefinition._create (cyclomatic 25) libs/agno_infra/agno/aws/resource/ecs/task_definition.py:95 — EcsTaskDefinition._create has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 02_error_retry_skip_streaming.main (cyclomatic 25) · ×1
  • 02_error_retry_skip_streaming.main (cyclomatic 25) cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:113 — 02_error_retry_skip_streaming.main has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · index.html.imageSearch.runSearch (cyclomatic 25) · ×1
  • index.html.imageSearch.runSearch (cyclomatic 25) cookbook/data_labeling/image_search/public/index.html:333 — index.html.imageSearch.runSearch has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _response.ahandle_model_response_stream (cyclomatic 24) · ×1
  • _response.ahandle_model_response_stream (cyclomatic 24) libs/agno/agno/agent/_response.py:1193 — _response.ahandle_model_response_stream has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _CompanyScheduleExecutor._tick (cyclomatic 24) · ×1
  • _CompanyScheduleExecutor._tick (cyclomatic 24) libs/agno/agno/company/routines.py:640 — _CompanyScheduleExecutor._tick has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sources.browse_source (cyclomatic 24) · ×1
  • sources.browse_source (cyclomatic 24) libs/agno/agno/company/sources.py:104 — sources.browse_source has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMySQLDb._create_table (cyclomatic 24) · ×1
  • AsyncMySQLDb._create_table (cyclomatic 24) libs/agno/agno/db/mysql/async_mysql.py:173 — AsyncMySQLDb._create_table has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MySQLDb._create_table (cyclomatic 24) · ×1
  • MySQLDb._create_table (cyclomatic 24) libs/agno/agno/db/mysql/mysql.py:169 — MySQLDb._create_table has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedisDb.get_sessions (cyclomatic 24) · ×1
  • RedisDb.get_sessions (cyclomatic 24) libs/agno/agno/db/redis/redis.py:711 — RedisDb.get_sessions has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SingleStoreDb.get_sessions (cyclomatic 24) · ×1
  • SingleStoreDb.get_sessions (cyclomatic 24) libs/agno/agno/db/singlestore/singlestore.py:1080 — SingleStoreDb.get_sessions has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ValkeyDb.get_sessions (cyclomatic 24) · ×1
  • ValkeyDb.get_sessions (cyclomatic 24) libs/agno/agno/db/valkey/valkey.py:837 — ValkeyDb.get_sessions has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageCorpus.__getitem__ (cyclomatic 24) · ×1
  • PageCorpus.__getitem__ (cyclomatic 24) libs/agno/agno/knowledge/page/filesystem.py:356 — PageCorpus.__getitem__ has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueWorker._execute_streaming (cyclomatic 24) · ×1
  • QueueWorker._execute_streaming (cyclomatic 24) libs/agno/agno/os/job_queue.py:1341 — QueueWorker._execute_streaming has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PublicSurface._bind (cyclomatic 24) · ×1
  • PublicSurface._bind (cyclomatic 24) libs/agno/agno/os/public/__init__.py:76 — PublicSurface._bind has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunOutput.from_dict (cyclomatic 24) · ×1
  • RunOutput.from_dict (cyclomatic 24) libs/agno/agno/run/agent.py:908 — RunOutput.from_dict has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ParallelTools.parallel_search (cyclomatic 24) · ×1
  • ParallelTools.parallel_search (cyclomatic 24) libs/agno/agno/tools/parallel.py:128 — ParallelTools.parallel_search has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SlackTools._build_instructions (cyclomatic 24) · ×1
  • SlackTools._build_instructions (cyclomatic 24) libs/agno/agno/tools/slack.py:40 — SlackTools._build_instructions has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools.update_schedule (cyclomatic 24) · ×1
  • StudioTools.update_schedule (cyclomatic 24) libs/agno/agno/tools/studio.py:4620 — StudioTools.update_schedule has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · media_offload._offload_single_media (cyclomatic 24) · ×1
  • media_offload._offload_single_media (cyclomatic 24) libs/agno/agno/utils/media_offload.py:180 — media_offload._offload_single_media has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (media_offload._aoffload_single_media) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · media_offload._aoffload_single_media (cyclomatic 24) · ×1
  • media_offload._aoffload_single_media (cyclomatic 24) libs/agno/agno/utils/media_offload.py:392 — media_offload._aoffload_single_media has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (media_offload._offload_single_media) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Workflow._enrich_event_with_workflow_context (cyclomatic 24) · ×1
  • Workflow._enrich_event_with_workflow_context (cyclomatic 24) libs/agno/agno/workflow/workflow.py:2680 — Workflow._enrich_event_with_workflow_context has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._arun_workflow_agent_stream (cyclomatic 24) · ×1
  • Workflow._arun_workflow_agent_stream (cyclomatic 24) libs/agno/agno/workflow/workflow.py:6174 — Workflow._arun_workflow_agent_stream has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TargetGroup._create (cyclomatic 24) · ×1
  • TargetGroup._create (cyclomatic 24) libs/agno_infra/agno/aws/resource/elb/target_group.py:39 — TargetGroup._create has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _response.update_run_response (cyclomatic 23) · ×1
  • _response.update_run_response (cyclomatic 23) libs/agno/agno/agent/_response.py:946 — _response.update_run_response has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _response.handle_model_response_stream (cyclomatic 23) · ×1
  • _response.handle_model_response_stream (cyclomatic 23) libs/agno/agno/agent/_response.py:1029 — _response.handle_model_response_stream has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexAgent._tool_result_from_item (cyclomatic 23) · ×1
  • CodexAgent._tool_result_from_item (cyclomatic 23) libs/agno/agno/agents/codex/agent.py:1139 — CodexAgent._tool_result_from_item has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sources._local_files (cyclomatic 23) · ×1
  • sources._local_files (cyclomatic 23) libs/agno/agno/company/sources.py:19 — sources._local_files has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · summary._summary_report (cyclomatic 23) · ×1
  • summary._summary_report (cyclomatic 23) libs/agno/agno/company/summary.py:118 — summary._summary_report has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_eval_runs (cyclomatic 23) · ×1
  • DynamoDb.get_eval_runs (cyclomatic 23) libs/agno/agno/db/dynamo/dynamo.py:2333 — DynamoDb.get_eval_runs has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FirestoreDb.get_trace_stats (cyclomatic 23) · ×1
  • FirestoreDb.get_trace_stats (cyclomatic 23) libs/agno/agno/db/firestore/firestore.py:2453 — FirestoreDb.get_trace_stats has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMySQLDb.get_sessions (cyclomatic 23) · ×1
  • AsyncMySQLDb.get_sessions (cyclomatic 23) libs/agno/agno/db/mysql/async_mysql.py:1032 — AsyncMySQLDb.get_sessions has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncMySQLDb.get_eval_runs (cyclomatic 23) · ×1
  • AsyncMySQLDb.get_eval_runs (cyclomatic 23) libs/agno/agno/db/mysql/async_mysql.py:2606 — AsyncMySQLDb.get_eval_runs has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MySQLDb.get_sessions (cyclomatic 23) · ×1
  • MySQLDb.get_sessions (cyclomatic 23) libs/agno/agno/db/mysql/mysql.py:1025 — MySQLDb.get_sessions has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_eval_runs (cyclomatic 23) · ×1
  • AsyncPostgresDb.get_eval_runs (cyclomatic 23) libs/agno/agno/db/postgres/async_postgres.py:2978 — AsyncPostgresDb.get_eval_runs has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_trace_stats (cyclomatic 23) · ×1
  • AsyncPostgresDb.get_trace_stats (cyclomatic 23) libs/agno/agno/db/postgres/async_postgres.py:3507 — AsyncPostgresDb.get_trace_stats has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.get_trace_stats (cyclomatic 23) · ×1
  • PostgresDb.get_trace_stats (cyclomatic 23) libs/agno/agno/db/postgres/postgres.py:4048 — PostgresDb.get_trace_stats has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SurrealDb.get_sessions (cyclomatic 23) · ×1
  • SurrealDb.get_sessions (cyclomatic 23) libs/agno/agno/db/surrealdb/surrealdb.py:630 — SurrealDb.get_sessions has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · suite.acli (cyclomatic 23) · ×1
  • suite.acli (cyclomatic 23) libs/agno/agno/eval/suite.py:854 — suite.acli has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MarkdownChunking._split_large_section (cyclomatic 23) · ×1
  • MarkdownChunking._split_large_section (cyclomatic 23) libs/agno/agno/knowledge/chunking/markdown.py:40 — MarkdownChunking._split_large_section has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EntityMemoryStore._forget_edge (cyclomatic 23) · ×1
  • EntityMemoryStore._forget_edge (cyclomatic 23) libs/agno/agno/learn/stores/entity_memory.py:2368 — EntityMemoryStore._forget_edge has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp.get_mcp_server (cyclomatic 23) · ×1
  • mcp.get_mcp_server (cyclomatic 23) libs/agno/agno/os/mcp.py:3293 — mcp.get_mcp_server has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AuthMiddleware._check_scopes (cyclomatic 23) · ×1
  • AuthMiddleware._check_scopes (cyclomatic 23) libs/agno/agno/os/middleware/jwt.py:1078 — AuthMiddleware._check_scopes has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AuthMiddleware._acheck_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AuthMiddleware._acheck_scopes (cyclomatic 23) · ×1
  • AuthMiddleware._acheck_scopes (cyclomatic 23) libs/agno/agno/os/middleware/jwt.py:1278 — AuthMiddleware._acheck_scopes has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AuthMiddleware._check_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AuthMiddleware._deny_for_schedule_owner (cyclomatic 23) · ×1
  • AuthMiddleware._deny_for_schedule_owner (cyclomatic 23) libs/agno/agno/os/middleware/jwt.py:1803 — AuthMiddleware._deny_for_schedule_owner has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · router.agent_continue_response_streamer (cyclomatic 23) · ×1
  • router.agent_continue_response_streamer (cyclomatic 23) libs/agno/agno/os/routers/agents/router.py:290 — router.agent_continue_response_streamer has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.get_knowledge_instance (cyclomatic 23) · ×1
  • utils.get_knowledge_instance (cyclomatic 23) libs/agno/agno/os/utils.py:884 — utils.get_knowledge_instance has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · approval._sync_requirements_after_approval (cyclomatic 23) · ×1
  • approval._sync_requirements_after_approval (cyclomatic 23) libs/agno/agno/run/approval.py:693 — approval._sync_requirements_after_approval has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolCallScorer.score (cyclomatic 23) · ×1
  • ToolCallScorer.score (cyclomatic 23) libs/agno/agno/scorer/tools.py:80 — ToolCallScorer.score has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._handle_team_run_cancellation (cyclomatic 23) · ×1
  • _run._handle_team_run_cancellation (cyclomatic 23) libs/agno/agno/team/_run.py:4391 — _run._handle_team_run_cancellation has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._group_requirements_for_continue (cyclomatic 23) · ×1
  • _run._group_requirements_for_continue (cyclomatic 23) libs/agno/agno/team/_run.py:6262 — _run._group_requirements_for_continue has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _utils._deep_copy_field (cyclomatic 23) · ×1
  • _utils._deep_copy_field (cyclomatic 23) libs/agno/agno/team/_utils.py:163 — _utils._deep_copy_field has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · FunctionCall._build_entrypoint_args (cyclomatic 23) · ×1
  • FunctionCall._build_entrypoint_args (cyclomatic 23) libs/agno/agno/tools/function.py:2266 — FunctionCall._build_entrypoint_args has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WhatsAppTools.__init__ (cyclomatic 23) · ×1
  • WhatsAppTools.__init__ (cyclomatic 23) libs/agno/agno/tools/whatsapp.py:35 — WhatsAppTools.__init__ has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · prompts.get_json_output_prompt (cyclomatic 23) · ×1
  • prompts.get_json_output_prompt (cyclomatic 23) libs/agno/agno/utils/prompts.py:9 — prompts.get_json_output_prompt has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · streamlit._load_session (cyclomatic 23) · ×1
  • streamlit._load_session (cyclomatic 23) libs/agno/agno/utils/streamlit.py:201 — streamlit._load_session has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LanceDb.__init__ (cyclomatic 23) · ×1
  • LanceDb.__init__ (cyclomatic 23) REDACTED:46 — LanceDb.__init__ has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Loop.execute (cyclomatic 23) · ×1
  • Loop.execute (cyclomatic 23) libs/agno/agno/workflow/loop.py:422 — Loop.execute has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Loop.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Loop.aexecute (cyclomatic 23) · ×1
  • Loop.aexecute (cyclomatic 23) libs/agno/agno/workflow/loop.py:827 — Loop.aexecute has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Loop.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ContinueExecutionState.__init__ (cyclomatic 23) · ×1
  • ContinueExecutionState.__init__ (cyclomatic 23) libs/agno/agno/workflow/utils/hitl.py:406 — ContinueExecutionState.__init__ has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CacheCluster._update (cyclomatic 23) · ×1
  • CacheCluster._update (cyclomatic 23) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:286 — CacheCluster._update has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · InfraConfig.get_resources (cyclomatic 23) · ×1
  • InfraConfig.get_resources (cyclomatic 23) libs/agno_infra/agno/infra/config.py:104 — InfraConfig.get_resources has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · disruption_catchup.test_full_catchup (cyclomatic 23) · ×1
  • disruption_catchup.test_full_catchup (cyclomatic 23) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:36 — disruption_catchup.test_full_catchup has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _tools.get_tools (cyclomatic 22) · ×1
  • _tools.get_tools (cyclomatic 22) libs/agno/agno/agent/_tools.py:202 — _tools.get_tools has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ClaudeAgent._aquery_sdk (cyclomatic 22) · ×1
  • ClaudeAgent._aquery_sdk (cyclomatic 22) libs/agno/agno/agents/claude/agent.py:457 — ClaudeAgent._aquery_sdk has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClaudeAgent._arun_adapter (cyclomatic 22) · ×1
  • ClaudeAgent._arun_adapter (cyclomatic 22) libs/agno/agno/agents/claude/agent.py:1065 — ClaudeAgent._arun_adapter has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · A2AClient._build_message_request (cyclomatic 22) · ×1
  • A2AClient._build_message_request (cyclomatic 22) libs/agno/agno/client/a2a/client.py:74 — A2AClient._build_message_request has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v1_to_v2.convert_v1_media_to_v2 (cyclomatic 22) · ×1
  • v1_to_v2.convert_v1_media_to_v2 (cyclomatic 22) REDACTED:180 — v1_to_v2.convert_v1_media_to_v2 has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v1_to_v2.convert_v1_fields_to_v2 (cyclomatic 22) · ×1
  • v1_to_v2.convert_v1_fields_to_v2 (cyclomatic 22) REDACTED:251 — v1_to_v2.convert_v1_fields_to_v2 has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3_0_0._migrate_async_postgres_user_id (cyclomatic 22) · ×1
  • v3_0_0._migrate_async_postgres_user_id (cyclomatic 22) REDACTED:3161 — v3_0_0._migrate_async_postgres_user_id has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb.get_eval_runs (cyclomatic 22) · ×1
  • AsyncMongoDb.get_eval_runs (cyclomatic 22) libs/agno/agno/db/mongo/async_mongo.py:2350 — AsyncMongoDb.get_eval_runs has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MongoDb.get_eval_runs (cyclomatic 22) · ×1
  • MongoDb.get_eval_runs (cyclomatic 22) libs/agno/agno/db/mongo/mongo.py:2155 — MongoDb.get_eval_runs has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_span_stats (cyclomatic 22) · ×1
  • AsyncPostgresDb.get_span_stats (cyclomatic 22) libs/agno/agno/db/postgres/async_postgres.py:3827 — AsyncPostgresDb.get_span_stats has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.get_span_stats (cyclomatic 22) · ×1
  • PostgresDb.get_span_stats (cyclomatic 22) libs/agno/agno/db/postgres/postgres.py:4366 — PostgresDb.get_span_stats has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.upsert_component (cyclomatic 22) · ×1
  • PostgresDb.upsert_component (cyclomatic 22) libs/agno/agno/db/postgres/postgres.py:4571 — PostgresDb.upsert_component has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_eval_runs (cyclomatic 22) · ×1
  • AsyncSqliteDb.get_eval_runs (cyclomatic 22) REDACTED:3128 — AsyncSqliteDb.get_eval_runs has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_trace_stats (cyclomatic 22) · ×1
  • AsyncSqliteDb.get_trace_stats (cyclomatic 22) REDACTED:3652 — AsyncSqliteDb.get_trace_stats has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SqliteDb.get_trace_stats (cyclomatic 22) · ×1
  • SqliteDb.get_trace_stats (cyclomatic 22) REDACTED:3851 — SqliteDb.get_trace_stats has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ValkeyDb.delete_eval_runs (cyclomatic 22) · ×1
  • ValkeyDb.delete_eval_runs (cyclomatic 22) libs/agno/agno/db/valkey/valkey.py:2147 — ValkeyDb.delete_eval_runs has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ParallelPageFetcher.fetch_many (cyclomatic 22) · ×1
  • ParallelPageFetcher.fetch_many (cyclomatic 22) libs/agno/agno/knowledge/reader/page_fetcher.py:349 — ParallelPageFetcher.fetch_many has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SitemapReader._discover (cyclomatic 22) · ×1
  • SitemapReader._discover (cyclomatic 22) REDACTED:171 — SitemapReader._discover has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EntityMemoryStore.build_context (cyclomatic 22) · ×1
  • EntityMemoryStore.build_context (cyclomatic 22) libs/agno/agno/learn/stores/entity_memory.py:702 — EntityMemoryStore.build_context has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiteLLM._get_metrics (cyclomatic 22) · ×1
  • LiteLLM._get_metrics (cyclomatic 22) libs/agno/agno/models/litellm/chat.py:521 — LiteLLM._get_metrics has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Ollama._format_message (cyclomatic 22) · ×1
  • Ollama._format_message (cyclomatic 22) libs/agno/agno/models/ollama/chat.py:150 — Ollama._format_message has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentOS._add_auth_middleware (cyclomatic 22) · ×1
  • AgentOS._add_auth_middleware (cyclomatic 22) libs/agno/agno/os/app.py:2291 — AgentOS._add_auth_middleware has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · mcp._locate_component (cyclomatic 22) · ×1
  • mcp._locate_component (cyclomatic 22) libs/agno/agno/os/mcp.py:1644 — mcp._locate_component has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunInput.to_dict (cyclomatic 22) · ×1
  • RunInput.to_dict (cyclomatic 22) libs/agno/agno/run/agent.py:77 — RunInput.to_dict has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · approval._agroup_tools_by_approval (cyclomatic 22) · ×1
  • approval._agroup_tools_by_approval (cyclomatic 22) libs/agno/agno/run/approval.py:634 — approval._agroup_tools_by_approval has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TeamRunInput.to_dict (cyclomatic 22) · ×1
  • TeamRunInput.to_dict (cyclomatic 22) libs/agno/agno/run/team.py:63 — TeamRunInput.to_dict has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._acontinue_run_background_stream (cyclomatic 22) · ×1
  • _run._acontinue_run_background_stream (cyclomatic 22) libs/agno/agno/team/_run.py:8659 — _run._acontinue_run_background_stream has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _storage._hydrate_from_graph (cyclomatic 22) · ×1
  • _storage._hydrate_from_graph (cyclomatic 22) libs/agno/agno/team/_storage.py:1527 — _storage._hydrate_from_graph has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DoclingTools.__init__ (cyclomatic 22) · ×1
  • DoclingTools.__init__ (cyclomatic 22) libs/agno/agno/tools/docling.py:48 — DoclingTools.__init__ has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GoogleCalendarTools.__init__ (cyclomatic 22) · ×1
  • GoogleCalendarTools.__init__ (cyclomatic 22) libs/agno/agno/tools/google/calendar.py:50 — GoogleCalendarTools.__init__ has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GoogleSheetsTools.__init__ (cyclomatic 22) · ×1
  • GoogleSheetsTools.__init__ (cyclomatic 22) libs/agno/agno/tools/google/sheets.py:76 — GoogleSheetsTools.__init__ has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OpenCVTools.capture_video (cyclomatic 22) · ×1
  • OpenCVTools.capture_video (cyclomatic 22) libs/agno/agno/tools/opencv.py:147 — OpenCVTools.capture_video has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioRunnerTools._require_faithful_rebuild (cyclomatic 22) · ×1
  • StudioRunnerTools._require_faithful_rebuild (cyclomatic 22) libs/agno/agno/tools/studio_runner.py:1209 — StudioRunnerTools._require_faithful_rebuild has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TwilioTools.__init__ (cyclomatic 22) · ×1
  • TwilioTools.__init__ (cyclomatic 22) libs/agno/agno/tools/twilio.py:16 — TwilioTools.__init__ has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Workflow._run_workflow_agent_stream (cyclomatic 22) · ×1
  • Workflow._run_workflow_agent_stream (cyclomatic 22) libs/agno/agno/workflow/workflow.py:5775 — Workflow._run_workflow_agent_stream has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · disconnect._report (cyclomatic 22) · ×1
  • disconnect._report (cyclomatic 22) libs/agnoctl/agnoctl/commands/disconnect.py:247 — disconnect._report has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _utils.deep_copy_field (cyclomatic 21) · ×1
  • _utils.deep_copy_field (cyclomatic 21) libs/agno/agno/agent/_utils.py:181 — _utils.deep_copy_field has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · DynamoDb.get_spans (cyclomatic 21) · ×1
  • DynamoDb.get_spans (cyclomatic 21) libs/agno/agno/db/dynamo/dynamo.py:3135 — DynamoDb.get_spans has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InMemoryDb.get_runs (cyclomatic 21) · ×1
  • InMemoryDb.get_runs (cyclomatic 21) libs/agno/agno/db/in_memory/in_memory_db.py:496 — InMemoryDb.get_runs has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb._ensure_client (cyclomatic 21) · ×1
  • AsyncMongoDb._ensure_client (cyclomatic 21) libs/agno/agno/db/mongo/async_mongo.py:295 — AsyncMongoDb._ensure_client has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MySQLDb.get_eval_runs (cyclomatic 21) · ×1
  • MySQLDb.get_eval_runs (cyclomatic 21) libs/agno/agno/db/mysql/mysql.py:2574 — MySQLDb.get_eval_runs has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.get_eval_runs (cyclomatic 21) · ×1
  • PostgresDb.get_eval_runs (cyclomatic 21) libs/agno/agno/db/postgres/postgres.py:3521 — PostgresDb.get_eval_runs has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.set_current_version (cyclomatic 21) · ×1
  • PostgresDb.set_current_version (cyclomatic 21) libs/agno/agno/db/postgres/postgres.py:6156 — PostgresDb.set_current_version has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedisDb.get_trace_stats (cyclomatic 21) · ×1
  • RedisDb.get_trace_stats (cyclomatic 21) libs/agno/agno/db/redis/redis.py:2215 — RedisDb.get_trace_stats has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SingleStoreDb.get_eval_runs (cyclomatic 21) · ×1
  • SingleStoreDb.get_eval_runs (cyclomatic 21) libs/agno/agno/db/singlestore/singlestore.py:2570 — SingleStoreDb.get_eval_runs has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_span_stats (cyclomatic 21) · ×1
  • AsyncSqliteDb.get_span_stats (cyclomatic 21) REDACTED:3958 — AsyncSqliteDb.get_span_stats has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SqliteDb.get_eval_runs (cyclomatic 21) · ×1
  • SqliteDb.get_eval_runs (cyclomatic 21) REDACTED:3381 — SqliteDb.get_eval_runs has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqliteDb.get_span_stats (cyclomatic 21) · ×1
  • SqliteDb.get_span_stats (cyclomatic 21) REDACTED:4152 — SqliteDb.get_span_stats has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.set_current_version (cyclomatic 21) · ×1
  • SqliteDb.set_current_version (cyclomatic 21) REDACTED:5945 — SqliteDb.set_current_version has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentAsJudgeEval.run (cyclomatic 21) · ×1
  • AgentAsJudgeEval.run (cyclomatic 21) libs/agno/agno/eval/agent_as_judge.py:479 — AgentAsJudgeEval.run has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Knowledge._build_remote_content_identity (cyclomatic 21) · ×1
  • Knowledge._build_remote_content_identity (cyclomatic 21) libs/agno/agno/knowledge/knowledge.py:4137 — Knowledge._build_remote_content_identity has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mdx._esm_end (cyclomatic 21) · ×1
  • mdx._esm_end (cyclomatic 21) libs/agno/agno/knowledge/reader/utils/mdx.py:257 — mdx._esm_end has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Cohere.get_request_params (cyclomatic 21) · ×1
  • Cohere.get_request_params (cyclomatic 21) libs/agno/agno/models/cohere/chat.py:137 — Cohere.get_request_params has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiteLLM._parse_provider_response_delta (cyclomatic 21) · ×1
  • LiteLLM._parse_provider_response_delta (cyclomatic 21) libs/agno/agno/models/litellm/chat.py:386 — LiteLLM._parse_provider_response_delta has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MoonShot._format_message (cyclomatic 21) · ×1
  • MoonShot._format_message (cyclomatic 21) libs/agno/agno/models/moonshot/moonshot.py:253 — MoonShot._format_message has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIChat._format_message (cyclomatic 21) · ×1
  • OpenAIChat._format_message (cyclomatic 21) libs/agno/agno/models/openai/chat.py:314 — OpenAIChat._format_message has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.map_a2a_request_to_run_input (cyclomatic 21) · ×1
  • utils.map_a2a_request_to_run_input (cyclomatic 21) libs/agno/agno/os/interfaces/a2a/utils.py:86 — utils.map_a2a_request_to_run_input has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp_results.build_custom_tool_result (cyclomatic 21) · ×1
  • mcp_results.build_custom_tool_result (cyclomatic 21) libs/agno/agno/os/mcp_results.py:148 — mcp_results.build_custom_tool_result has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils._collect_components_from_step (cyclomatic 21) · ×1
  • utils._collect_components_from_step (cyclomatic 21) libs/agno/agno/os/utils.py:2562 — utils._collect_components_from_step has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · status_persist.apersist_run_transition (cyclomatic 21) · ×1
  • status_persist.apersist_run_transition (cyclomatic 21) libs/agno/agno/run/status_persist.py:125 — status_persist.apersist_run_transition has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GoogleCalendarTools.find_available_slots (cyclomatic 21) · ×1
  • GoogleCalendarTools.find_available_slots (cyclomatic 21) libs/agno/agno/tools/google/calendar.py:529 — GoogleCalendarTools.find_available_slots has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GmailTools._extract_body (cyclomatic 21) · ×1
  • GmailTools._extract_body (cyclomatic 21) libs/agno/agno/tools/google/gmail.py:1364 — GmailTools._extract_body has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GoogleSlidesTools.add_slide (cyclomatic 21) · ×1
  • GoogleSlidesTools.add_slide (cyclomatic 21) libs/agno/agno/tools/google/slides.py:377 — GoogleSlidesTools.add_slide has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JiraTools.__init__ (cyclomatic 21) · ×1
  • JiraTools.__init__ (cyclomatic 21) libs/agno/agno/tools/jira.py:15 — JiraTools.__init__ has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · StudioTools._edit_component (cyclomatic 21) · ×1
  • StudioTools._edit_component (cyclomatic 21) libs/agno/agno/tools/studio.py:2836 — StudioTools._edit_component has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools.publish_component (cyclomatic 21) · ×1
  • StudioTools.publish_component (cyclomatic 21) libs/agno/agno/tools/studio.py:3256 — StudioTools.publish_component has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Toolkit._register_decorated_tool (cyclomatic 21) · ×1
  • Toolkit._register_decorated_tool (cyclomatic 21) libs/agno/agno/tools/toolkit.py:328 — Toolkit._register_decorated_tool has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · response.get_paused_content (cyclomatic 21) · ×1
  • response.get_paused_content (cyclomatic 21) libs/agno/agno/utils/response.py:120 — response.get_paused_content has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Parallel._aggregate_results (cyclomatic 21) · ×1
  • Parallel._aggregate_results (cyclomatic 21) libs/agno/agno/workflow/parallel.py:182 — Parallel._aggregate_results has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Workflow.to_dict (cyclomatic 21) · ×1
  • Workflow.to_dict (cyclomatic 21) libs/agno/agno/workflow/workflow.py:1212 — Workflow.to_dict has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · migrate_sentinel_vectordbs.migrate_couchbase (cyclomatic 21) · ×1
  • migrate_sentinel_vectordbs.migrate_couchbase (cyclomatic 21) libs/agno/migrations/v2_to_v3/migrate_sentinel_vectordbs.py:174 — migrate_sentinel_vectordbs.migrate_couchbase has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _hooks.aexecute_pre_hooks (cyclomatic 20) · ×1
  • _hooks.aexecute_pre_hooks (cyclomatic 20) libs/agno/agno/agent/_hooks.py:154 — _hooks.aexecute_pre_hooks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_hooks.aexecute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _hooks.aexecute_post_hooks (cyclomatic 20) · ×1
  • _hooks.aexecute_post_hooks (cyclomatic 20) libs/agno/agno/agent/_hooks.py:363 — _hooks.aexecute_post_hooks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_hooks.aexecute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _tools.ahandle_tool_call_updates (cyclomatic 20) · ×1
  • _tools.ahandle_tool_call_updates (cyclomatic 20) libs/agno/agno/agent/_tools.py:1178 — _tools.ahandle_tool_call_updates has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_tools.ahandle_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _tools.ahandle_tool_call_updates_stream (cyclomatic 20) · ×1
  • _tools.ahandle_tool_call_updates_stream (cyclomatic 20) libs/agno/agno/agent/_tools.py:1234 — _tools.ahandle_tool_call_updates_stream has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_tools.ahandle_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ClaudeAgent._annotate_run_output (cyclomatic 20) · ×1
  • ClaudeAgent._annotate_run_output (cyclomatic 20) libs/agno/agno/agents/claude/agent.py:592 — ClaudeAgent._annotate_run_output has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · notion_ops.blocks_to_markdown (cyclomatic 20) · ×1
  • notion_ops.blocks_to_markdown (cyclomatic 20) libs/agno/agno/context/wiki/notion_ops.py:173 — notion_ops.blocks_to_markdown has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FirestoreDb.upsert_trace (cyclomatic 20) · ×1
  • FirestoreDb.upsert_trace (cyclomatic 20) libs/agno/agno/db/firestore/firestore.py:2217 — FirestoreDb.upsert_trace has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v1_to_v2.safe_get_runs_from_memory (cyclomatic 20) · ×1
  • v1_to_v2.safe_get_runs_from_memory (cyclomatic 20) REDACTED:134 — v1_to_v2.safe_get_runs_from_memory has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3_0_0._migrate_postgres_user_id (cyclomatic 20) · ×1
  • v3_0_0._migrate_postgres_user_id (cyclomatic 20) REDACTED:3068 — v3_0_0._migrate_postgres_user_id has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncPostgresDb.update_run_in_session (cyclomatic 20) · ×1
  • AsyncPostgresDb.update_run_in_session (cyclomatic 20) libs/agno/agno/db/postgres/async_postgres.py:4839 — AsyncPostgresDb.update_run_in_session has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.update_run_in_session (cyclomatic 20) · ×1
  • PostgresDb.update_run_in_session (cyclomatic 20) libs/agno/agno/db/postgres/postgres.py:7583 — PostgresDb.update_run_in_session has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SurrealDb.upsert_trace (cyclomatic 20) · ×1
  • SurrealDb.upsert_trace (cyclomatic 20) libs/agno/agno/db/surrealdb/surrealdb.py:1767 — SurrealDb.upsert_trace has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _validate.validate_sft_jsonl (cyclomatic 20) · ×1
  • _validate.validate_sft_jsonl (cyclomatic 20) libs/agno/agno/environments/exporters/_validate.py:20 — _validate.validate_sft_jsonl has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentAsJudgeEval.arun (cyclomatic 20) · ×1
  • AgentAsJudgeEval.arun (cyclomatic 20) libs/agno/agno/eval/agent_as_judge.py:580 — AgentAsJudgeEval.arun has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PageCoordinator.__init__ (cyclomatic 20) · ×1
  • PageCoordinator.__init__ (cyclomatic 20) REDACTED:121 — PageCoordinator.__init__ has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EntityMemoryStore.print (cyclomatic 20) · ×1
  • EntityMemoryStore.print (cyclomatic 20) libs/agno/agno/learn/stores/entity_memory.py:3661 — EntityMemoryStore.print has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionMetrics.__add__ (cyclomatic 20) · ×1
  • SessionMetrics.__add__ (cyclomatic 20) libs/agno/agno/metrics.py:558 — SessionMetrics.__add__ has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · metrics.accumulate_model_metrics (cyclomatic 20) · ×1
  • metrics.accumulate_model_metrics (cyclomatic 20) libs/agno/agno/metrics.py:632 — metrics.accumulate_model_metrics has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · metrics.merge_background_metrics (cyclomatic 20) · ×1
  • metrics.merge_background_metrics (cyclomatic 20) libs/agno/agno/metrics.py:770 — metrics.merge_background_metrics has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiteLLM.parse_tool_calls (cyclomatic 20) · ×1
  • LiteLLM.parse_tool_calls (cyclomatic 20) libs/agno/agno/models/litellm/chat.py:433 — LiteLLM.parse_tool_calls has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIResponses.invoke (cyclomatic 20) · ×1
  • OpenAIResponses.invoke (cyclomatic 20) libs/agno/agno/models/openai/responses.py:864 — OpenAIResponses.invoke has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (OpenAIResponses.ainvoke) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · OpenAIResponses.ainvoke (cyclomatic 20) · ×1
  • OpenAIResponses.ainvoke (cyclomatic 20) libs/agno/agno/models/openai/responses.py:985 — OpenAIResponses.ainvoke has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (OpenAIResponses.invoke) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · diagnostics.arun_diagnostics (cyclomatic 20) · ×1
  • diagnostics.arun_diagnostics (cyclomatic 20) libs/agno/agno/os/diagnostics.py:83 — diagnostics.arun_diagnostics has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandbox.sandbox_run_response (cyclomatic 20) · ×1
  • sandbox.sandbox_run_response (cyclomatic 20) libs/agno/agno/os/routers/agents/sandbox.py:121 — sandbox.sandbox_run_response has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.run_performance_eval (cyclomatic 20) · ×1
  • utils.run_performance_eval (cyclomatic 20) libs/agno/agno/os/routers/evals/utils.py:120 — utils.run_performance_eval has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TraceNode.from_span (cyclomatic 20) · ×1
  • TraceNode.from_span (cyclomatic 20) libs/agno/agno/os/routers/traces/schemas.py:69 — TraceNode.from_span has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · router.workflow_response_streamer (cyclomatic 20) · ×1
  • router.workflow_response_streamer (cyclomatic 20) libs/agno/agno/os/routers/workflows/router.py:1167 — router.workflow_response_streamer has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.get_session_name (cyclomatic 20) · ×1
  • utils.get_session_name (cyclomatic 20) libs/agno/agno/os/utils.py:1004 — utils.get_session_name has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · approval._group_tools_by_approval (cyclomatic 20) · ×1
  • approval._group_tools_by_approval (cyclomatic 20) libs/agno/agno/run/approval.py:570 — approval._group_tools_by_approval has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TeamRunOutput.from_dict (cyclomatic 20) · ×1
  • TeamRunOutput.from_dict (cyclomatic 20) libs/agno/agno/run/team.py:978 — TeamRunOutput.from_dict has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ScheduleExecutor._call_endpoint (cyclomatic 20) · ×1
  • ScheduleExecutor._call_endpoint (cyclomatic 20) libs/agno/agno/scheduler/executor.py:331 — ScheduleExecutor._call_endpoint has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _hooks._aexecute_pre_hooks (cyclomatic 20) · ×1
  • _hooks._aexecute_pre_hooks (cyclomatic 20) libs/agno/agno/team/_hooks.py:338 — _hooks._aexecute_pre_hooks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_hooks._aexecute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _hooks._aexecute_post_hooks (cyclomatic 20) · ×1
  • _hooks._aexecute_post_hooks (cyclomatic 20) libs/agno/agno/team/_hooks.py:536 — _hooks._aexecute_post_hooks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_hooks._aexecute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _init.__init__ (cyclomatic 20) · ×1
  • _init.__init__ (cyclomatic 20) libs/agno/agno/team/_init.py:67 — _init.__init__ has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SnapshotManager.restore (cyclomatic 20) · ×1
  • SnapshotManager.restore (cyclomatic 20) libs/agno/agno/tools/code/snapshot.py:411 — SnapshotManager.restore has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NanoBananaTools.create_image (cyclomatic 20) · ×1
  • NanoBananaTools.create_image (cyclomatic 20) libs/agno/agno/tools/nano_banana.py:70 — NanoBananaTools.create_image has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workspace._list_files (cyclomatic 20) · ×1
  • Workspace._list_files (cyclomatic 20) libs/agno/agno/tools/workspace.py:736 — Workspace._list_files has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent.scrub_media_from_message (cyclomatic 20) · ×1
  • agent.scrub_media_from_message (cyclomatic 20) libs/agno/agno/utils/agent.py:509 — agent.scrub_media_from_message has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · claude._format_image_for_message (cyclomatic 20) · ×1
  • claude._format_image_for_message (cyclomatic 20) libs/agno/agno/utils/models/claude.py:255 — claude._format_image_for_message has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tokens._count_message_tokens (cyclomatic 20) · ×1
  • tokens._count_message_tokens (cyclomatic 20) REDACTED:553 — tokens._count_message_tokens has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Condition.execute (cyclomatic 20) · ×1
  • Condition.execute (cyclomatic 20) libs/agno/agno/workflow/condition.py:474 — Condition.execute has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Condition.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Condition.aexecute (cyclomatic 20) · ×1
  • Condition.aexecute (cyclomatic 20) libs/agno/agno/workflow/condition.py:929 — Condition.aexecute has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Condition.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · StepRequirement._validate_user_input (cyclomatic 20) · ×1
  • StepRequirement._validate_user_input (cyclomatic 20) libs/agno/agno/workflow/types.py:953 — StepRequirement._validate_user_input has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._arun_workflow_agent (cyclomatic 20) · ×1
  • Workflow._arun_workflow_agent (cyclomatic 20) libs/agno/agno/workflow/workflow.py:6368 — Workflow._arun_workflow_agent has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow.deep_copy (cyclomatic 20) · ×1
  • Workflow.deep_copy (cyclomatic 20) libs/agno/agno/workflow/workflow.py:11682 — Workflow.deep_copy has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · PostgresDb.get_container_env (cyclomatic 20) · ×1
  • PostgresDb.get_container_env (cyclomatic 20) libs/agno_infra/agno/docker/app/postgres/postgres.py:61 — PostgresDb.get_container_env has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · InfraConfig.get_resources_from_file (cyclomatic 20) · ×1
  • InfraConfig.get_resources_from_file (cyclomatic 20) libs/agno_infra/agno/infra/config.py:214 — InfraConfig.get_resources_from_file has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · operator.create_infra_from_template (cyclomatic 20) · ×1
  • operator.create_infra_from_template (cyclomatic 20) libs/agno_infra/agno/infra/operator.py:32 — operator.create_infra_from_template has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · step_history.analyze_food_preferences (cyclomatic 20) · ×1
  • step_history.analyze_food_preferences (cyclomatic 20) cookbook/04_workflows/06_advanced_concepts/history/step_history.py:44 — step_history.analyze_food_preferences has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · events_replay.test_replay (cyclomatic 20) · ×1
  • events_replay.test_replay (cyclomatic 20) cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:38 — events_replay.test_replay has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _hooks.execute_pre_hooks (cyclomatic 19) · ×1
  • _hooks.execute_pre_hooks (cyclomatic 19) libs/agno/agno/agent/_hooks.py:43 — _hooks.execute_pre_hooks has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_hooks.execute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _hooks.execute_post_hooks (cyclomatic 19) · ×1
  • _hooks.execute_post_hooks (cyclomatic 19) libs/agno/agno/agent/_hooks.py:262 — _hooks.execute_post_hooks has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_hooks.execute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _run._continue_run (cyclomatic 19) · ×1
  • _run._continue_run (cyclomatic 19) libs/agno/agno/agent/_run.py:3650 — _run._continue_run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexAgent._acollect_turn (cyclomatic 19) · ×1
  • CodexAgent._acollect_turn (cyclomatic 19) libs/agno/agno/agents/codex/agent.py:785 — CodexAgent._acollect_turn has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_runs (cyclomatic 19) · ×1
  • DynamoDb.get_runs (cyclomatic 19) libs/agno/agno/db/dynamo/dynamo.py:449 — DynamoDb.get_runs has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GcsJsonDb.get_runs (cyclomatic 19) · ×1
  • GcsJsonDb.get_runs (cyclomatic 19) libs/agno/agno/db/gcs_json/gcs_json_db.py:324 — GcsJsonDb.get_runs has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GcsJsonDb.upsert_trace (cyclomatic 19) · ×1
  • GcsJsonDb.upsert_trace (cyclomatic 19) libs/agno/agno/db/gcs_json/gcs_json_db.py:1595 — GcsJsonDb.upsert_trace has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.get_runs (cyclomatic 19) · ×1
  • JsonDb.get_runs (cyclomatic 19) libs/agno/agno/db/json/json_db.py:360 — JsonDb.get_runs has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.upsert_trace (cyclomatic 19) · ×1
  • JsonDb.upsert_trace (cyclomatic 19) libs/agno/agno/db/json/json_db.py:1699 — JsonDb.upsert_trace has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncPostgresDb.upsert_knowledge_content (cyclomatic 19) · ×1
  • AsyncPostgresDb.upsert_knowledge_content (cyclomatic 19) libs/agno/agno/db/postgres/async_postgres.py:2743 — AsyncPostgresDb.upsert_knowledge_content has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.upsert_knowledge_content (cyclomatic 19) · ×1
  • PostgresDb.upsert_knowledge_content (cyclomatic 19) libs/agno/agno/db/postgres/postgres.py:3288 — PostgresDb.upsert_knowledge_content has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedisDb.enqueue_job (cyclomatic 19) · ×1
  • RedisDb.enqueue_job (cyclomatic 19) libs/agno/agno/db/redis/redis.py:2563 — RedisDb.enqueue_job has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._aload_from_path (cyclomatic 19) · ×1
  • Knowledge._aload_from_path (cyclomatic 19) libs/agno/agno/knowledge/knowledge.py:2394 — Knowledge._aload_from_path has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._load_from_path) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._load_from_path (cyclomatic 19) · ×1
  • Knowledge._load_from_path (cyclomatic 19) libs/agno/agno/knowledge/knowledge.py:2469 — Knowledge._load_from_path has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Knowledge._aload_from_path) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._build_content_hash (cyclomatic 19) · ×1
  • Knowledge._build_content_hash (cyclomatic 19) libs/agno/agno/knowledge/knowledge.py:4190 — Knowledge._build_content_hash has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · S3Loader._aload_from_s3 (cyclomatic 19) · ×1
  • S3Loader._aload_from_s3 (cyclomatic 19) libs/agno/agno/knowledge/loaders/s3.py:67 — S3Loader._aload_from_s3 has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FieldLabeledCSVReader.async_read (cyclomatic 19) · ×1
  • FieldLabeledCSVReader.async_read (cyclomatic 19) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:171 — FieldLabeledCSVReader.async_read has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageMetrics.__add__ (cyclomatic 19) · ×1
  • MessageMetrics.__add__ (cyclomatic 19) libs/agno/agno/metrics.py:196 — MessageMetrics.__add__ has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AwsBedrock.get_async_client (cyclomatic 19) · ×1
  • AwsBedrock.get_async_client (cyclomatic 19) libs/agno/agno/models/aws/bedrock.py:168 — AwsBedrock.get_async_client has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model._process_model_response (cyclomatic 19) · ×1
  • Model._process_model_response (cyclomatic 19) REDACTED:1107 — Model._process_model_response has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Model._aprocess_model_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Model._aprocess_model_response (cyclomatic 19) · ×1
  • Model._aprocess_model_response (cyclomatic 19) REDACTED:1177 — Model._aprocess_model_response has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Model._process_model_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · DeepSeek._format_message (cyclomatic 19) · ×1
  • DeepSeek._format_message (cyclomatic 19) libs/agno/agno/models/deepseek/deepseek.py:141 — DeepSeek._format_message has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Gemini._format_tool_result_media (cyclomatic 19) · ×1
  • Gemini._format_tool_result_media (cyclomatic 19) libs/agno/agno/models/google/gemini.py:970 — Gemini._format_tool_result_media has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Gemini._format_audio_for_message (cyclomatic 19) · ×1
  • Gemini._format_audio_for_message (cyclomatic 19) libs/agno/agno/models/google/gemini.py:1018 — Gemini._format_audio_for_message has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIResponses._format_tool_params (cyclomatic 19) · ×1
  • OpenAIResponses._format_tool_params (cyclomatic 19) libs/agno/agno/models/openai/responses.py:599 — OpenAIResponses._format_tool_params has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp._mcp_hidden_params (cyclomatic 19) · ×1
  • mcp._mcp_hidden_params (cyclomatic 19) libs/agno/agno/os/mcp.py:332 — mcp._mcp_hidden_params has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp._require_tool_scopes (cyclomatic 19) · ×1
  • mcp._require_tool_scopes (cyclomatic 19) libs/agno/agno/os/mcp.py:876 — mcp._require_tool_scopes has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · router.team_continue_response_streamer (cyclomatic 19) · ×1
  • router.team_continue_response_streamer (cyclomatic 19) libs/agno/agno/os/routers/teams/router.py:412 — router.team_continue_response_streamer has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _messages._get_json_output_prompt (cyclomatic 19) · ×1
  • _messages._get_json_output_prompt (cyclomatic 19) libs/agno/agno/team/_messages.py:1654 — _messages._get_json_output_prompt has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run.run_dispatch (cyclomatic 19) · ×1
  • _run.run_dispatch (cyclomatic 19) libs/agno/agno/team/_run.py:1901 — _run.run_dispatch has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._ahandle_team_tool_call_updates (cyclomatic 19) · ×1
  • _run._ahandle_team_tool_call_updates (cyclomatic 19) libs/agno/agno/team/_run.py:5520 — _run._ahandle_team_tool_call_updates has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (_run._ahandle_team_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _run._ahandle_team_tool_call_updates_stream (cyclomatic 19) · ×1
  • _run._ahandle_team_tool_call_updates_stream (cyclomatic 19) libs/agno/agno/team/_run.py:5598 — _run._ahandle_team_tool_call_updates_stream has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (_run._ahandle_team_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CodingTools._check_command (cyclomatic 19) · ×1
  • CodingTools._check_command (cyclomatic 19) libs/agno/agno/tools/coding.py:317 — CodingTools._check_command has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileTools.__init__ (cyclomatic 19) · ×1
  • FileTools.__init__ (cyclomatic 19) libs/agno/agno/tools/file/file.py:95 — FileTools.__init__ has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FileTools.search_content (cyclomatic 19) · ×1
  • FileTools.search_content (cyclomatic 19) libs/agno/agno/tools/file/file.py:350 — FileTools.search_content has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · YFinance.get_analyst_recommendations (cyclomatic 19) · ×1
  • YFinance.get_analyst_recommendations (cyclomatic 19) libs/agno/agno/tools/finance/providers/yfinance.py:322 — YFinance.get_analyst_recommendations has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelsLabTools.generate_media (cyclomatic 19) · ×1
  • ModelsLabTools.generate_media (cyclomatic 19) libs/agno/agno/tools/models_labs.py:164 — ModelsLabTools.generate_media has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OxylabsTools.search_google (cyclomatic 19) · ×1
  • OxylabsTools.search_google (cyclomatic 19) libs/agno/agno/tools/oxylabs.py:91 — OxylabsTools.search_google has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OxylabsTools.search_amazon_products (cyclomatic 19) · ×1
  • OxylabsTools.search_amazon_products (cyclomatic 19) libs/agno/agno/tools/oxylabs.py:263 — OxylabsTools.search_amazon_products has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OxylabsTools.scrape_website (cyclomatic 19) · ×1
  • OxylabsTools.scrape_website (cyclomatic 19) libs/agno/agno/tools/oxylabs.py:354 — OxylabsTools.scrape_website has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · YFinanceTools.__init__ (cyclomatic 19) · ×1
  • YFinanceTools.__init__ (cyclomatic 19) libs/agno/agno/tools/yfinance.py:31 — YFinanceTools.__init__ has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · llama.format_message (cyclomatic 19) · ×1
  • llama.format_message (cyclomatic 19) libs/agno/agno/utils/models/llama.py:22 — llama.format_message has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mistral.format_messages (cyclomatic 19) · ×1
  • mistral.format_messages (cyclomatic 19) libs/agno/agno/utils/models/mistral.py:49 — mistral.format_messages has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LanceDb.search (cyclomatic 19) · ×1
  • LanceDb.search (cyclomatic 19) REDACTED:597 — LanceDb.search has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PgVector.vector_search (cyclomatic 19) · ×1
  • PgVector.vector_search (cyclomatic 19) REDACTED:1044 — PgVector.vector_search has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PgVector.hybrid_search (cyclomatic 19) · ×1
  • PgVector.hybrid_search (cyclomatic 19) REDACTED:1312 — PgVector.hybrid_search has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Steps.execute (cyclomatic 19) · ×1
  • Steps.execute (cyclomatic 19) libs/agno/agno/workflow/steps.py:244 — Steps.execute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Steps.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Steps.aexecute (cyclomatic 19) · ×1
  • Steps.aexecute (cyclomatic 19) libs/agno/agno/workflow/steps.py:550 — Steps.aexecute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Steps.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Workflow._route_executor_requirements_stream (cyclomatic 19) · ×1
  • Workflow._route_executor_requirements_stream (cyclomatic 19) libs/agno/agno/workflow/workflow.py:7566 — Workflow._route_executor_requirements_stream has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Workflow._aroute_executor_requirements_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Workflow._aroute_executor_requirements_stream (cyclomatic 19) · ×1
  • Workflow._aroute_executor_requirements_stream (cyclomatic 19) libs/agno/agno/workflow/workflow.py:7655 — Workflow._aroute_executor_requirements_stream has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Workflow._route_executor_requirements_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Workflow.run (cyclomatic 19) · ×1
  • Workflow.run (cyclomatic 19) libs/agno/agno/workflow/workflow.py:10577 — Workflow.run has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run.arun_dispatch (cyclomatic 18) · ×1
  • _run.arun_dispatch (cyclomatic 18) libs/agno/agno/agent/_run.py:2711 — _run.arun_dispatch has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run.acontinue_run_dispatch (cyclomatic 18) · ×1
  • _run.acontinue_run_dispatch (cyclomatic 18) libs/agno/agno/agent/_run.py:4188 — _run.acontinue_run_dispatch has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _tools.handle_tool_call_updates (cyclomatic 18) · ×1
  • _tools.handle_tool_call_updates (cyclomatic 18) libs/agno/agno/agent/_tools.py:1076 — _tools.handle_tool_call_updates has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_tools.handle_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _tools.handle_tool_call_updates_stream (cyclomatic 18) · ×1
  • _tools.handle_tool_call_updates_stream (cyclomatic 18) libs/agno/agno/agent/_tools.py:1124 — _tools.handle_tool_call_updates_stream has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_tools.handle_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CodexAgent._tool_from_item (cyclomatic 18) · ×1
  • CodexAgent._tool_from_item (cyclomatic 18) libs/agno/agno/agents/codex/agent.py:1075 — CodexAgent._tool_from_item has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _TelemetryDispatcher.close (cyclomatic 18) · ×1
  • _TelemetryDispatcher.close (cyclomatic 18) libs/agno/agno/api/api.py:132 — _TelemetryDispatcher.close has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentOSClient.upload_knowledge_content (cyclomatic 18) · ×1
  • AgentOSClient.upload_knowledge_content (cyclomatic 18) libs/agno/agno/client/os.py:2444 — AgentOSClient.upload_knowledge_content has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DynamoDb.cleanup_legacy_runs_field (cyclomatic 18) · ×1
  • DynamoDb.cleanup_legacy_runs_field (cyclomatic 18) libs/agno/agno/db/dynamo/dynamo.py:360 — DynamoDb.cleanup_legacy_runs_field has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.upsert_trace (cyclomatic 18) · ×1
  • DynamoDb.upsert_trace (cyclomatic 18) libs/agno/agno/db/dynamo/dynamo.py:2511 — DynamoDb.upsert_trace has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FirestoreDb._get_collection (cyclomatic 18) · ×1
  • FirestoreDb._get_collection (cyclomatic 18) libs/agno/agno/db/firestore/firestore.py:126 — FirestoreDb._get_collection has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MigrationManager.up (cyclomatic 18) · ×1
  • MigrationManager.up (cyclomatic 18) libs/agno/agno/db/migrations/manager.py:34 — MigrationManager.up has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3_0_0._migrate_mysql_like_user_id (cyclomatic 18) · ×1
  • v3_0_0._migrate_mysql_like_user_id (cyclomatic 18) REDACTED:3334 — v3_0_0._migrate_mysql_like_user_id has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (v3_0_0._migrate_async_mysql_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · v3_0_0._migrate_async_mysql_user_id (cyclomatic 18) · ×1
  • v3_0_0._migrate_async_mysql_user_id (cyclomatic 18) REDACTED:3410 — v3_0_0._migrate_async_mysql_user_id has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (v3_0_0._migrate_mysql_like_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AsyncMongoDb.upsert_memories (cyclomatic 18) · ×1
  • AsyncMongoDb.upsert_memories (cyclomatic 18) libs/agno/agno/db/mongo/async_mongo.py:1751 — AsyncMongoDb.upsert_memories has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb.get_traces (cyclomatic 18) · ×1
  • AsyncMongoDb.get_traces (cyclomatic 18) libs/agno/agno/db/mongo/async_mongo.py:2763 — AsyncMongoDb.get_traces has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MongoDb.upsert_memories (cyclomatic 18) · ×1
  • MongoDb.upsert_memories (cyclomatic 18) libs/agno/agno/db/mongo/mongo.py:1557 — MongoDb.upsert_memories has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MongoDb.get_traces (cyclomatic 18) · ×1
  • MongoDb.get_traces (cyclomatic 18) libs/agno/agno/db/mongo/mongo.py:2627 — MongoDb.get_traces has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_traces (cyclomatic 18) · ×1
  • AsyncPostgresDb.get_traces (cyclomatic 18) libs/agno/agno/db/postgres/async_postgres.py:3403 — AsyncPostgresDb.get_traces has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.get_traces (cyclomatic 18) · ×1
  • PostgresDb.get_traces (cyclomatic 18) libs/agno/agno/db/postgres/postgres.py:3946 — PostgresDb.get_traces has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_runs (cyclomatic 18) · ×1
  • AsyncSqliteDb.get_runs (cyclomatic 18) REDACTED:1006 — AsyncSqliteDb.get_runs has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_traces (cyclomatic 18) · ×1
  • AsyncSqliteDb.get_traces (cyclomatic 18) REDACTED:3549 — AsyncSqliteDb.get_traces has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SqliteDb.get_runs (cyclomatic 18) · ×1
  • SqliteDb.get_runs (cyclomatic 18) REDACTED:1191 — SqliteDb.get_runs has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqliteDb.get_traces (cyclomatic 18) · ×1
  • SqliteDb.get_traces (cyclomatic 18) REDACTED:3743 — SqliteDb.get_traces has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ValkeyDb.delete_sessions (cyclomatic 18) · ×1
  • ValkeyDb.delete_sessions (cyclomatic 18) libs/agno/agno/db/valkey/valkey.py:720 — ValkeyDb.delete_sessions has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AccuracyEval.run_with_output (cyclomatic 18) · ×1
  • AccuracyEval.run_with_output (cyclomatic 18) libs/agno/agno/eval/accuracy.py:648 — AccuracyEval.run_with_output has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PerformanceEval.run (cyclomatic 18) · ×1
  • PerformanceEval.run (cyclomatic 18) libs/agno/agno/eval/performance.py:497 — PerformanceEval.run has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (PerformanceEval.arun) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · PerformanceEval.arun (cyclomatic 18) · ×1
  • PerformanceEval.arun (cyclomatic 18) libs/agno/agno/eval/performance.py:634 — PerformanceEval.arun has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (PerformanceEval.run) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._validate_filters (cyclomatic 18) · ×1
  • Knowledge._validate_filters (cyclomatic 18) libs/agno/agno/knowledge/knowledge.py:1794 — Knowledge._validate_filters has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GitHubLoader._aload_from_github (cyclomatic 18) · ×1
  • GitHubLoader._aload_from_github (cyclomatic 18) libs/agno/agno/knowledge/loaders/github.py:336 — GitHubLoader._aload_from_github has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (GitHubLoader._load_from_github) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · GitHubLoader._load_from_github (cyclomatic 18) · ×1
  • GitHubLoader._load_from_github (cyclomatic 18) libs/agno/agno/knowledge/loaders/github.py:495 — GitHubLoader._load_from_github has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (GitHubLoader._aload_from_github) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · S3Loader._load_from_s3 (cyclomatic 18) · ×1
  • S3Loader._load_from_s3 (cyclomatic 18) libs/agno/agno/knowledge/loaders/s3.py:169 — S3Loader._load_from_s3 has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageCoordinator._setup_complete (cyclomatic 18) · ×1
  • PageCoordinator._setup_complete (cyclomatic 18) REDACTED:306 — PageCoordinator._setup_complete has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EntityMemoryStore._apply_forget (cyclomatic 18) · ×1
  • EntityMemoryStore._apply_forget (cyclomatic 18) libs/agno/agno/learn/stores/entity_memory.py:2155 — EntityMemoryStore._apply_forget has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · metrics.accumulate_eval_metrics (cyclomatic 18) · ×1
  • metrics.accumulate_eval_metrics (cyclomatic 18) libs/agno/agno/metrics.py:714 — metrics.accumulate_eval_metrics has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Claude.get_request_params (cyclomatic 18) · ×1
  • Claude.get_request_params (cyclomatic 18) libs/agno/agno/models/anthropic/claude.py:542 — Claude.get_request_params has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Gemini._format_video_for_message (cyclomatic 18) · ×1
  • Gemini._format_video_for_message (cyclomatic 18) libs/agno/agno/models/google/gemini.py:1081 — Gemini._format_video_for_message has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiInteractions._call_step_info (cyclomatic 18) · ×1
  • GeminiInteractions._call_step_info (cyclomatic 18) libs/agno/agno/models/google/gemini_interactions.py:659 — GeminiInteractions._call_step_info has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RoleStore.patch_role_scopes (cyclomatic 18) · ×1
  • RoleStore.patch_role_scopes (cyclomatic 18) libs/agno/agno/os/authz/_role_store.py:497 — RoleStore.patch_role_scopes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (RoleStore.apatch_role_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · RoleStore.apatch_role_scopes (cyclomatic 18) · ×1
  • RoleStore.apatch_role_scopes (cyclomatic 18) libs/agno/agno/os/authz/_role_store.py:1008 — RoleStore.apatch_role_scopes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (RoleStore.patch_role_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · HITLHandler.handle_check_status (cyclomatic 18) · ×1
  • HITLHandler.handle_check_status (cyclomatic 18) libs/agno/agno/os/interfaces/slack/hitl.py:361 — HITLHandler.handle_check_status has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MCPIdentityBridgeMiddleware.__call__ (cyclomatic 18) · ×1
  • MCPIdentityBridgeMiddleware.__call__ (cyclomatic 18) libs/agno/agno/os/mcp_auth.py:207 — MCPIdentityBridgeMiddleware.__call__ has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.run_reliability_eval (cyclomatic 18) · ×1
  • utils.run_reliability_eval (cyclomatic 18) libs/agno/agno/os/routers/evals/utils.py:179 — utils.run_reliability_eval has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.queued_run_tail_streamer (cyclomatic 18) · ×1
  • utils.queued_run_tail_streamer (cyclomatic 18) libs/agno/agno/os/utils.py:410 — utils.queued_run_tail_streamer has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.collect_mcp_tools_from_team (cyclomatic 18) · ×1
  • utils.collect_mcp_tools_from_team (cyclomatic 18) libs/agno/agno/os/utils.py:2315 — utils.collect_mcp_tools_from_team has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.resolve_agent (cyclomatic 18) · ×1
  • utils.resolve_agent (cyclomatic 18) libs/agno/agno/os/utils.py:2956 — utils.resolve_agent has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · _hooks._execute_pre_hooks (cyclomatic 18) · ×1
  • _hooks._execute_pre_hooks (cyclomatic 18) libs/agno/agno/team/_hooks.py:240 — _hooks._execute_pre_hooks has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (_hooks._execute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _hooks._execute_post_hooks (cyclomatic 18) · ×1
  • _hooks._execute_post_hooks (cyclomatic 18) libs/agno/agno/team/_hooks.py:441 — _hooks._execute_post_hooks has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (_hooks._execute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _messages._get_run_messages (cyclomatic 18) · ×1
  • _messages._get_run_messages (cyclomatic 18) libs/agno/agno/team/_messages.py:944 — _messages._get_run_messages has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages._aget_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _messages._aget_run_messages (cyclomatic 18) · ×1
  • _messages._aget_run_messages (cyclomatic 18) libs/agno/agno/team/_messages.py:1079 — _messages._aget_run_messages has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_messages._get_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _run._build_continue_run_messages (cyclomatic 18) · ×1
  • _run._build_continue_run_messages (cyclomatic 18) libs/agno/agno/team/_run.py:5272 — _run._build_continue_run_messages has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run._continue_run (cyclomatic 18) · ×1
  • _run._continue_run (cyclomatic 18) libs/agno/agno/team/_run.py:8168 — _run._continue_run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · apify.props_to_json_schema (cyclomatic 18) · ×1
  • apify.props_to_json_schema (cyclomatic 18) libs/agno/agno/tools/apify.py:134 — apify.props_to_json_schema has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodingTools.__init__ (cyclomatic 18) · ×1
  • CodingTools.__init__ (cyclomatic 18) libs/agno/agno/tools/coding.py:140 — CodingTools.__init__ has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PlivoTools.__init__ (cyclomatic 18) · ×1
  • PlivoTools.__init__ (cyclomatic 18) libs/agno/agno/tools/plivo.py:16 — PlivoTools.__init__ has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · RedmineTools.update_issue (cyclomatic 18) · ×1
  • RedmineTools.update_issue (cyclomatic 18) libs/agno/agno/tools/redmine.py:198 — RedmineTools.update_issue has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools.list_components (cyclomatic 18) · ×1
  • StudioTools.list_components (cyclomatic 18) libs/agno/agno/tools/studio.py:1900 — StudioTools.list_components has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools.create_schedule (cyclomatic 18) · ×1
  • StudioTools.create_schedule (cyclomatic 18) libs/agno/agno/tools/studio.py:4456 — StudioTools.create_schedule has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioRunnerTools._check_references (cyclomatic 18) · ×1
  • StudioRunnerTools._check_references (cyclomatic 18) libs/agno/agno/tools/studio_runner.py:1419 — StudioRunnerTools._check_references has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · functions.get_function_call (cyclomatic 18) · ×1
  • functions.get_function_call (cyclomatic 18) REDACTED:10 — functions.get_function_call has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp.prepare_command (cyclomatic 18) · ×1
  • mcp.prepare_command (cyclomatic 18) libs/agno/agno/utils/mcp.py:377 — mcp.prepare_command has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · tokens.count_file_tokens (cyclomatic 18) · ×1
  • tokens.count_file_tokens (cyclomatic 18) REDACTED:308 — tokens.count_file_tokens has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChromaDb.update_metadata (cyclomatic 18) · ×1
  • ChromaDb.update_metadata (cyclomatic 18) REDACTED:1702 — ChromaDb.update_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CouchbaseSearch.async_insert (cyclomatic 18) · ×1
  • CouchbaseSearch.async_insert (cyclomatic 18) REDACTED:1074 — CouchbaseSearch.async_insert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (CouchbaseSearch._async_upsert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CouchbaseSearch._async_upsert (cyclomatic 18) · ×1
  • CouchbaseSearch._async_upsert (cyclomatic 18) REDACTED:1190 — CouchbaseSearch._async_upsert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (CouchbaseSearch.async_insert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · MongoDb._create_search_index (cyclomatic 18) · ×1
  • MongoDb._create_search_index (cyclomatic 18) REDACTED:257 — MongoDb._create_search_index has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Weaviate.async_insert (cyclomatic 18) · ×1
  • Weaviate.async_insert (cyclomatic 18) REDACTED:364 — Weaviate.async_insert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.execute (cyclomatic 18) · ×1
  • Router.execute (cyclomatic 18) libs/agno/agno/workflow/router.py:621 — Router.execute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Router.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Router.aexecute (cyclomatic 18) · ×1
  • Router.aexecute (cyclomatic 18) libs/agno/agno/workflow/router.py:952 — Router.aexecute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Router.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Step._enrich_event_with_context (cyclomatic 18) · ×1
  • Step._enrich_event_with_context (cyclomatic 18) libs/agno/agno/workflow/step.py:1370 — Step._enrich_event_with_context has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._run_workflow_agent (cyclomatic 18) · ×1
  • Workflow._run_workflow_agent (cyclomatic 18) libs/agno/agno/workflow/workflow.py:5949 — Workflow._run_workflow_agent has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow._find_inner_step_by_executor (cyclomatic 18) · ×1
  • workflow._find_inner_step_by_executor (cyclomatic 18) libs/agno/agno/workflow/workflow.py:277 — workflow._find_inner_step_by_executor has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GlueCrawler._create (cyclomatic 18) · ×1
  • GlueCrawler._create (cyclomatic 18) libs/agno_infra/agno/aws/resource/glue/crawler.py:122 — GlueCrawler._create has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 02_tool_error_persistence.scenario_b_model_call_fails (cyclomatic 18) · ×1
  • 02_tool_error_persistence.scenario_b_model_call_fails (cyclomatic 18) cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:95 — 02_tool_error_persistence.scenario_b_model_call_fails has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 11_streaming_events.streaming_with_events (cyclomatic 18) · ×1
  • 11_streaming_events.streaming_with_events (cyclomatic 18) cookbook/03_teams/02_modes/tasks/11_streaming_events.py:74 — 11_streaming_events.streaming_with_events has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _init.get_models (cyclomatic 17) · ×1
  • _init.get_models (cyclomatic 17) libs/agno/agno/agent/_init.py:435 — _init.get_models has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._handle_run_cancellation (cyclomatic 17) · ×1
  • _run._handle_run_cancellation (cyclomatic 17) libs/agno/agno/agent/_run.py:5895 — _run._handle_run_cancellation has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _session.get_session (cyclomatic 17) · ×1
  • _session.get_session (cyclomatic 17) libs/agno/agno/agent/_session.py:75 — _session.get_session has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · automation_history._record_task_failures (cyclomatic 17) · ×1
  • automation_history._record_task_failures (cyclomatic 17) libs/agno/agno/company/automation_history.py:31 — automation_history._record_task_failures has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _CompanyScheduleExecutor._complete_projects (cyclomatic 17) · ×1
  • _CompanyScheduleExecutor._complete_projects (cyclomatic 17) libs/agno/agno/company/routines.py:707 — _CompanyScheduleExecutor._complete_projects has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_user_memories (cyclomatic 17) · ×1
  • DynamoDb.get_user_memories (cyclomatic 17) libs/agno/agno/db/dynamo/dynamo.py:1297 — DynamoDb.get_user_memories has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FirestoreDb.get_runs (cyclomatic 17) · ×1
  • FirestoreDb.get_runs (cyclomatic 17) libs/agno/agno/db/firestore/firestore.py:413 — FirestoreDb.get_runs has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FirestoreDb.upsert_session (cyclomatic 17) · ×1
  • FirestoreDb.upsert_session (cyclomatic 17) libs/agno/agno/db/firestore/firestore.py:956 — FirestoreDb.upsert_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FirestoreDb._get_all_sessions_for_metrics_calculation (cyclomatic 17) · ×1
  • FirestoreDb._get_all_sessions_for_metrics_calculation (cyclomatic 17) libs/agno/agno/db/firestore/firestore.py:1543 — FirestoreDb._get_all_sessions_for_metrics_calculation has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.calculate_date_metrics (cyclomatic 17) · ×1
  • utils.calculate_date_metrics (cyclomatic 17) libs/agno/agno/db/firestore/utils.py:193 — utils.calculate_date_metrics has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3_0_0._revert_surrealdb (cyclomatic 17) · ×1
  • v3_0_0._revert_surrealdb (cyclomatic 17) REDACTED:2471 — v3_0_0._revert_surrealdb has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb.upsert_session (cyclomatic 17) · ×1
  • AsyncMongoDb.upsert_session (cyclomatic 17) libs/agno/agno/db/mongo/async_mongo.py:1151 — AsyncMongoDb.upsert_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MongoDb.upsert_session (cyclomatic 17) · ×1
  • MongoDb.upsert_session (cyclomatic 17) libs/agno/agno/db/mongo/mongo.py:962 — MongoDb.upsert_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncMySQLDb.get_runs (cyclomatic 17) · ×1
  • AsyncMySQLDb.get_runs (cyclomatic 17) libs/agno/agno/db/mysql/async_mysql.py:735 — AsyncMySQLDb.get_runs has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncMySQLDb.get_user_memories (cyclomatic 17) · ×1
  • AsyncMySQLDb.get_user_memories (cyclomatic 17) libs/agno/agno/db/mysql/async_mysql.py:1690 — AsyncMySQLDb.get_user_memories has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_runs (cyclomatic 17) · ×1
  • AsyncPostgresDb.get_runs (cyclomatic 17) libs/agno/agno/db/postgres/async_postgres.py:1055 — AsyncPostgresDb.get_runs has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb._cascade_tool_results (cyclomatic 17) · ×1
  • AsyncPostgresDb._cascade_tool_results (cyclomatic 17) libs/agno/agno/db/postgres/async_postgres.py:1382 — AsyncPostgresDb._cascade_tool_results has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncPostgresDb.upsert_session (cyclomatic 17) · ×1
  • AsyncPostgresDb.upsert_session (cyclomatic 17) libs/agno/agno/db/postgres/async_postgres.py:1816 — AsyncPostgresDb.upsert_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_user_memories (cyclomatic 17) · ×1
  • AsyncPostgresDb.get_user_memories (cyclomatic 17) libs/agno/agno/db/postgres/async_postgres.py:2089 — AsyncPostgresDb.get_user_memories has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb._cascade_tool_results (cyclomatic 17) · ×1
  • PostgresDb._cascade_tool_results (cyclomatic 17) libs/agno/agno/db/postgres/postgres.py:1553 — PostgresDb._cascade_tool_results has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresDb.upsert_session (cyclomatic 17) · ×1
  • PostgresDb.upsert_session (cyclomatic 17) libs/agno/agno/db/postgres/postgres.py:2045 — PostgresDb.upsert_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.restore_component (cyclomatic 17) · ×1
  • PostgresDb.restore_component (cyclomatic 17) libs/agno/agno/db/postgres/postgres.py:4956 — PostgresDb.restore_component has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedisDb.upsert_trace (cyclomatic 17) · ×1
  • RedisDb.upsert_trace (cyclomatic 17) libs/agno/agno/db/redis/redis.py:1965 — RedisDb.upsert_trace has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tasks.validate_task_fields (cyclomatic 17) · ×1
  • tasks.validate_task_fields (cyclomatic 17) libs/agno/agno/db/schemas/tasks.py:16 — tasks.validate_task_fields has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AsyncSqliteDb._cascade_tool_results (cyclomatic 17) · ×1
  • AsyncSqliteDb._cascade_tool_results (cyclomatic 17) REDACTED:1307 — AsyncSqliteDb._cascade_tool_results has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_session (cyclomatic 17) · ×1
  • AsyncSqliteDb.get_session (cyclomatic 17) REDACTED:1438 — AsyncSqliteDb.get_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SqliteDb._cascade_tool_results (cyclomatic 17) · ×1
  • SqliteDb._cascade_tool_results (cyclomatic 17) REDACTED:1504 — SqliteDb._cascade_tool_results has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqliteDb.get_session (cyclomatic 17) · ×1
  • SqliteDb.get_session (cyclomatic 17) REDACTED:1700 — SqliteDb.get_session has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqliteDb.restore_component (cyclomatic 17) · ×1
  • SqliteDb.restore_component (cyclomatic 17) REDACTED:4797 — SqliteDb.restore_component has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SurrealDb.get_traces (cyclomatic 17) · ×1
  • SurrealDb.get_traces (cyclomatic 17) libs/agno/agno/db/surrealdb/surrealdb.py:1935 — SurrealDb.get_traces has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.delete_user_memories (cyclomatic 17) · ×1
  • ValkeyDb.delete_user_memories (cyclomatic 17) libs/agno/agno/db/valkey/valkey.py:1306 — ValkeyDb.delete_user_memories has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.get_metrics (cyclomatic 17) · ×1
  • ValkeyDb.get_metrics (cyclomatic 17) libs/agno/agno/db/valkey/valkey.py:1882 — ValkeyDb.get_metrics has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb.upsert_trace (cyclomatic 17) · ×1
  • ValkeyDb.upsert_trace (cyclomatic 17) libs/agno/agno/db/valkey/valkey.py:2399 — ValkeyDb.upsert_trace has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AccuracyEval.arun_with_output (cyclomatic 17) · ×1
  • AccuracyEval.arun_with_output (cyclomatic 17) libs/agno/agno/eval/accuracy.py:764 — AccuracyEval.arun_with_output has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DocumentChunking.chunk (cyclomatic 17) · ×1
  • DocumentChunking.chunk (cyclomatic 17) libs/agno/agno/knowledge/chunking/document.py:18 — DocumentChunking.chunk has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Knowledge._prepare_page_child (cyclomatic 17) · ×1
  • Knowledge._prepare_page_child (cyclomatic 17) libs/agno/agno/knowledge/knowledge.py:3281 — Knowledge._prepare_page_child has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Knowledge._aupdate_content (cyclomatic 17) · ×1
  • Knowledge._aupdate_content (cyclomatic 17) libs/agno/agno/knowledge/knowledge.py:4868 — Knowledge._aupdate_content has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AzureBlobLoader._aload_from_azure_blob (cyclomatic 17) · ×1
  • AzureBlobLoader._aload_from_azure_blob (cyclomatic 17) libs/agno/agno/knowledge/loaders/azure_blob.py:148 — AzureBlobLoader._aload_from_azure_blob has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AzureBlobLoader._load_from_azure_blob) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AzureBlobLoader._load_from_azure_blob (cyclomatic 17) · ×1
  • AzureBlobLoader._load_from_azure_blob (cyclomatic 17) libs/agno/agno/knowledge/loaders/azure_blob.py:297 — AzureBlobLoader._load_from_azure_blob has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (AzureBlobLoader._aload_from_azure_blob) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CSVReader.async_read (cyclomatic 17) · ×1
  • CSVReader.async_read (cyclomatic 17) libs/agno/agno/knowledge/reader/csv_reader.py:133 — CSVReader.async_read has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TavilyReader._extract (cyclomatic 17) · ×1
  • TavilyReader._extract (cyclomatic 17) libs/agno/agno/knowledge/reader/tavily_reader.py:83 — TavilyReader._extract has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · machine.describe_learning_machine (cyclomatic 17) · ×1
  • machine.describe_learning_machine (cyclomatic 17) libs/agno/agno/learn/machine.py:1255 — machine.describe_learning_machine has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelMetrics.accumulate (cyclomatic 17) · ×1
  • ModelMetrics.accumulate (cyclomatic 17) libs/agno/agno/metrics.py:68 — ModelMetrics.accumulate has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionMetrics.accumulate_from_run (cyclomatic 17) · ×1
  • SessionMetrics.accumulate_from_run (cyclomatic 17) libs/agno/agno/metrics.py:505 — SessionMetrics.accumulate_from_run has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentOS.serve (cyclomatic 17) · ×1
  • AgentOS.serve (cyclomatic 17) libs/agno/agno/os/app.py:3242 — AgentOS.serve has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueWorker.acancel_queued (cyclomatic 17) · ×1
  • QueueWorker.acancel_queued (cyclomatic 17) libs/agno/agno/os/job_queue.py:1240 — QueueWorker.acancel_queued has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mcp._consume_workflow_stream (cyclomatic 17) · ×1
  • mcp._consume_workflow_stream (cyclomatic 17) libs/agno/agno/os/mcp.py:1185 — mcp._consume_workflow_stream has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_permissions._require_endpoint_permission (cyclomatic 17) · ×1
  • run_permissions._require_endpoint_permission (cyclomatic 17) libs/agno/agno/os/routers/run_permissions.py:14 — run_permissions._require_endpoint_permission has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · approval._apply_approval_to_tools (cyclomatic 17) · ×1
  • approval._apply_approval_to_tools (cyclomatic 17) libs/agno/agno/run/approval.py:421 — approval._apply_approval_to_tools has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScheduleExecutor._poll_run (cyclomatic 17) · ×1
  • ScheduleExecutor._poll_run (cyclomatic 17) libs/agno/agno/scheduler/executor.py:535 — ScheduleExecutor._poll_run has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _init.initialize_team (cyclomatic 17) · ×1
  • _init.initialize_team (cyclomatic 17) libs/agno/agno/team/_init.py:856 — _init.initialize_team has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._handle_team_tool_call_updates (cyclomatic 17) · ×1
  • _run._handle_team_tool_call_updates (cyclomatic 17) libs/agno/agno/team/_run.py:5383 — _run._handle_team_tool_call_updates has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_run._handle_team_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _run._handle_team_tool_call_updates_stream (cyclomatic 17) · ×1
  • _run._handle_team_tool_call_updates_stream (cyclomatic 17) libs/agno/agno/team/_run.py:5444 — _run._handle_team_tool_call_updates_stream has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_run._handle_team_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · team.get_team_by_id (cyclomatic 17) · ×1
  • team.get_team_by_id (cyclomatic 17) libs/agno/agno/team/team.py:1886 — team.get_team_by_id has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AntigravityTools._load_agent_directory (cyclomatic 17) · ×1
  • AntigravityTools._load_agent_directory (cyclomatic 17) libs/agno/agno/tools/antigravity.py:140 — AntigravityTools._load_agent_directory has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CalComTools.__init__ (cyclomatic 17) · ×1
  • CalComTools.__init__ (cyclomatic 17) libs/agno/agno/tools/calcom.py:16 — CalComTools.__init__ has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChartTools._build_spec (cyclomatic 17) · ×1
  • ChartTools._build_spec (cyclomatic 17) libs/agno/agno/tools/chart.py:166 — ChartTools._build_spec has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bridge._stub_doc (cyclomatic 17) · ×1
  • bridge._stub_doc (cyclomatic 17) libs/agno/agno/tools/code/bridge.py:258 — bridge._stub_doc has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KernelSession.ensure_started (cyclomatic 17) · ×1
  • KernelSession.ensure_started (cyclomatic 17) libs/agno/agno/tools/code/kernel.py:384 — KernelSession.ensure_started has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodingTools.grep (cyclomatic 17) · ×1
  • CodingTools.grep (cyclomatic 17) libs/agno/agno/tools/coding.py:672 — CodingTools.grep has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodingTools.ls (cyclomatic 17) · ×1
  • CodingTools.ls (cyclomatic 17) libs/agno/agno/tools/coding.py:820 — CodingTools.ls has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · toolkit._clean (cyclomatic 17) · ×1
  • toolkit._clean (cyclomatic 17) libs/agno/agno/tools/finance/toolkit.py:712 — toolkit._clean has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GoogleDriveTools.__init__ (cyclomatic 17) · ×1
  • GoogleDriveTools.__init__ (cyclomatic 17) libs/agno/agno/tools/google/drive.py:274 — GoogleDriveTools.__init__ has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Mem0Tools.__init__ (cyclomatic 17) · ×1
  • Mem0Tools.__init__ (cyclomatic 17) libs/agno/agno/tools/mem0.py:17 — Mem0Tools.__init__ has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OxylabsTools.get_amazon_product (cyclomatic 17) · ×1
  • OxylabsTools.get_amazon_product (cyclomatic 17) libs/agno/agno/tools/oxylabs.py:166 — OxylabsTools.get_amazon_product has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScavioTools.__init__ (cyclomatic 17) · ×1
  • ScavioTools.__init__ (cyclomatic 17) libs/agno/agno/tools/scavio.py:15 — ScavioTools.__init__ has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ShopifyTools.get_product_sales_breakdown (cyclomatic 17) · ×1
  • ShopifyTools.get_product_sales_breakdown (cyclomatic 17) libs/agno/agno/tools/shopify.py:776 — ShopifyTools.get_product_sales_breakdown has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools._buildable_tool (cyclomatic 17) · ×1
  • StudioTools._buildable_tool (cyclomatic 17) libs/agno/agno/tools/studio.py:1235 — StudioTools._buildable_tool has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools.archive_component (cyclomatic 17) · ×1
  • StudioTools.archive_component (cyclomatic 17) libs/agno/agno/tools/studio.py:3523 — StudioTools.archive_component has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioTools._links_for_component (cyclomatic 17) · ×1
  • StudioTools._links_for_component (cyclomatic 17) libs/agno/agno/tools/studio.py:5291 — StudioTools._links_for_component has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValyuTools._valyu_search (cyclomatic 17) · ×1
  • ValyuTools._valyu_search (cyclomatic 17) libs/agno/agno/tools/valyu.py:111 — ValyuTools._valyu_search has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Workspace._search_content (cyclomatic 17) · ×1
  • Workspace._search_content (cyclomatic 17) libs/agno/agno/tools/workspace.py:815 — Workspace._search_content has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · YouTools.you_search (cyclomatic 17) · ×1
  • YouTools.you_search (cyclomatic 17) libs/agno/agno/tools/youcom.py:122 — YouTools.you_search has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · agent.get_last_run_output_util (cyclomatic 17) · ×1
  • agent.get_last_run_output_util (cyclomatic 17) libs/agno/agno/utils/agent.py:886 — agent.get_last_run_output_util has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pprint.pprint_run_response (cyclomatic 17) · ×1
  • pprint.pprint_run_response (cyclomatic 17) libs/agno/agno/utils/pprint.py:13 — pprint.pprint_run_response has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (pprint.apprint_run_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · pprint.apprint_run_response (cyclomatic 17) · ×1
  • pprint.apprint_run_response (cyclomatic 17) libs/agno/agno/utils/pprint.py:97 — pprint.apprint_run_response has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (pprint.pprint_run_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Cassandra.async_insert (cyclomatic 17) · ×1
  • Cassandra.async_insert (cyclomatic 17) REDACTED:240 — Cassandra.async_insert has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LanceDb.update_metadata (cyclomatic 17) · ×1
  • LanceDb.update_metadata (cyclomatic 17) REDACTED:1127 — LanceDb.update_metadata has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MongoDb.search (cyclomatic 17) · ×1
  • MongoDb.search (cyclomatic 17) REDACTED:639 — MongoDb.search has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PgVector.__init__ (cyclomatic 17) · ×1
  • PgVector.__init__ (cyclomatic 17) REDACTED:73 — PgVector.__init__ has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UpstashVectorDb.update_metadata (cyclomatic 17) · ×1
  • UpstashVectorDb.update_metadata (cyclomatic 17) REDACTED:804 — UpstashVectorDb.update_metadata has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Condition._update_step_input_from_outputs (cyclomatic 17) · ×1
  • Condition._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/condition.py:326 — Condition._update_step_input_from_outputs has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Loop._update_step_input_from_outputs (cyclomatic 17) · ×1
  • Loop._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/loop.py:377 — Loop._update_step_input_from_outputs has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Router._update_step_input_from_outputs (cyclomatic 17) · ×1
  • Router._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/router.py:422 — Router._update_step_input_from_outputs has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Steps._update_step_input_from_outputs (cyclomatic 17) · ×1
  • Steps._update_step_input_from_outputs (cyclomatic 17) libs/agno/agno/workflow/steps.py:200 — Steps._update_step_input_from_outputs has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Workflow._propagate_hooks_to_step (cyclomatic 17) · ×1
  • Workflow._propagate_hooks_to_step (cyclomatic 17) libs/agno/agno/workflow/workflow.py:11470 — Workflow._propagate_hooks_to_step has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.get_workflow_by_id (cyclomatic 17) · ×1
  • workflow.get_workflow_by_id (cyclomatic 17) libs/agno/agno/workflow/workflow.py:11917 — workflow.get_workflow_by_id has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EbsVolume._create (cyclomatic 17) · ×1
  • EbsVolume._create (cyclomatic 17) libs/agno_infra/agno/aws/resource/ec2/volume.py:95 — EbsVolume._create has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DockerApp.get_container_env (cyclomatic 17) · ×1
  • DockerApp.get_container_env (cyclomatic 17) libs/agno_infra/agno/docker/app/base.py:131 — DockerApp.get_container_env has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DockerImage.buildx (cyclomatic 17) · ×1
  • DockerImage.buildx (cyclomatic 17) libs/agno_infra/agno/docker/resource/image.py:91 — DockerImage.buildx has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 09_custom_tools.assess_risk_score (cyclomatic 17) · ×1
  • 09_custom_tools.assess_risk_score (cyclomatic 17) cookbook/03_teams/02_modes/tasks/09_custom_tools.py:75 — 09_custom_tools.assess_risk_score has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · cancel_run.long_running_task (cyclomatic 17) · ×1
  • cancel_run.long_running_task (cyclomatic 17) cookbook/03_teams/14_run_control/cancel_run.py:22 — cancel_run.long_running_task has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · studio_hitl_agent_os.resolve_paused_tools (cyclomatic 17) · ×1
  • studio_hitl_agent_os.resolve_paused_tools (cyclomatic 17) cookbook/05_agent_os/22_studio/studio_hitl_agent_os.py:113 — studio_hitl_agent_os.resolve_paused_tools has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · soak.main (cyclomatic 17) · ×1
  • soak.main (cyclomatic 17) cookbook/frameworks/reliability/soak.py:82 — soak.main has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · run_all.print_agno_vs_table (cyclomatic 17) · ×1
  • run_all.print_agno_vs_table (cyclomatic 17) cookbook/performance/comparison/run_all.py:62 — run_all.print_agno_vs_table has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · report.render_group (cyclomatic 17) · ×1
  • report.render_group (cyclomatic 17) cookbook/performance/report.py:304 — report.render_group has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · console.html.advance (cyclomatic 17) · ×1
  • console.html.advance (cyclomatic 17) cookbook/05_agent_os/26_authorization/console.html:353 — console.html.advance has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · _default_tools._extract_session_preview (cyclomatic 16) · ×1
  • _default_tools._extract_session_preview (cyclomatic 16) libs/agno/agno/agent/_default_tools.py:443 — _default_tools._extract_session_preview has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _managers.make_memories (cyclomatic 16) · ×1
  • _managers.make_memories (cyclomatic 16) libs/agno/agno/agent/_managers.py:29 — _managers.make_memories has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_managers.amake_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _managers.amake_memories (cyclomatic 16) · ×1
  • _managers.amake_memories (cyclomatic 16) libs/agno/agno/agent/_managers.py:84 — _managers.amake_memories has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_managers.make_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _messages._build_continue_run_messages (cyclomatic 16) · ×1
  • _messages._build_continue_run_messages (cyclomatic 16) libs/agno/agno/agent/_messages.py:2309 — _messages._build_continue_run_messages has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run.run_dispatch (cyclomatic 16) · ×1
  • _run.run_dispatch (cyclomatic 16) libs/agno/agno/agent/_run.py:1321 — _run.run_dispatch has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._truncate_run_to_checkpoint (cyclomatic 16) · ×1
  • _run._truncate_run_to_checkpoint (cyclomatic 16) libs/agno/agno/agent/_run.py:2943 — _run._truncate_run_to_checkpoint has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _session.aget_session (cyclomatic 16) · ×1
  • _session.aget_session (cyclomatic 16) libs/agno/agno/agent/_session.py:155 — _session.aget_session has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _storage.resolve_memory_manager_reference (cyclomatic 16) · ×1
  • _storage.resolve_memory_manager_reference (cyclomatic 16) libs/agno/agno/agent/_storage.py:96 — _storage.resolve_memory_manager_reference has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _tools.run_tool (cyclomatic 16) · ×1
  • _tools.run_tool (cyclomatic 16) libs/agno/agno/agent/_tools.py:859 — _tools.run_tool has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_tools.arun_tool) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · _tools.arun_tool (cyclomatic 16) · ×1
  • _tools.arun_tool (cyclomatic 16) libs/agno/agno/agent/_tools.py:974 — _tools.arun_tool has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (_tools.run_tool) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ClaudeAgent._tool_batches (cyclomatic 16) · ×1
  • ClaudeAgent._tool_batches (cyclomatic 16) libs/agno/agno/agents/claude/agent.py:646 — ClaudeAgent._tool_batches has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.validate_google_credentials (cyclomatic 16) · ×1
  • utils.validate_google_credentials (cyclomatic 16) libs/agno/agno/context/google/utils.py:14 — utils.validate_google_credentials has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_user_memory_stats (cyclomatic 16) · ×1
  • DynamoDb.get_user_memory_stats (cyclomatic 16) libs/agno/agno/db/dynamo/dynamo.py:1417 — DynamoDb.get_user_memory_stats has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DynamoDb.get_metrics (cyclomatic 16) · ×1
  • DynamoDb.get_metrics (cyclomatic 16) libs/agno/agno/db/dynamo/dynamo.py:1965 — DynamoDb.get_metrics has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FirestoreDb.get_traces (cyclomatic 16) · ×1
  • FirestoreDb.get_traces (cyclomatic 16) libs/agno/agno/db/firestore/firestore.py:2360 — FirestoreDb.get_traces has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GcsJsonDb.get_user_memories (cyclomatic 16) · ×1
  • GcsJsonDb.get_user_memories (cyclomatic 16) libs/agno/agno/db/gcs_json/gcs_json_db.py:901 — GcsJsonDb.get_user_memories has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InMemoryDb.get_user_memories (cyclomatic 16) · ×1
  • InMemoryDb.get_user_memories (cyclomatic 16) libs/agno/agno/db/in_memory/in_memory_db.py:743 — InMemoryDb.get_user_memories has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · JsonDb.get_user_memories (cyclomatic 16) · ×1
  • JsonDb.get_user_memories (cyclomatic 16) libs/agno/agno/db/json/json_db.py:968 — JsonDb.get_user_memories has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v1_to_v2.get_table_content_in_batches (cyclomatic 16) · ×1
  • v1_to_v2.get_table_content_in_batches (cyclomatic 16) REDACTED:453 — v1_to_v2.get_table_content_in_batches has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3_0_0._revert_firestore (cyclomatic 16) · ×1
  • v3_0_0._revert_firestore (cyclomatic 16) REDACTED:1790 — v3_0_0._revert_firestore has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3_0_0._migrate_dynamodb (cyclomatic 16) · ×1
  • v3_0_0._migrate_dynamodb (cyclomatic 16) REDACTED:2253 — v3_0_0._migrate_dynamodb has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AsyncMongoDb.get_trace_stats (cyclomatic 16) · ×1
  • AsyncMongoDb.get_trace_stats (cyclomatic 16) libs/agno/agno/db/mongo/async_mongo.py:2862 — AsyncMongoDb.get_trace_stats has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MongoDb.get_trace_stats (cyclomatic 16) · ×1
  • MongoDb.get_trace_stats (cyclomatic 16) libs/agno/agno/db/mongo/mongo.py:2726 — MongoDb.get_trace_stats has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncMySQLDb.upsert_session (cyclomatic 16) · ×1
  • AsyncMySQLDb.upsert_session (cyclomatic 16) libs/agno/agno/db/mysql/async_mysql.py:1220 — AsyncMySQLDb.upsert_session has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MySQLDb.get_runs (cyclomatic 16) · ×1
  • MySQLDb.get_runs (cyclomatic 16) libs/agno/agno/db/mysql/mysql.py:724 — MySQLDb.get_runs has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.transition_project (cyclomatic 16) · ×1
  • AsyncPostgresDb.transition_project (cyclomatic 16) libs/agno/agno/db/postgres/async_postgres.py:6779 — AsyncPostgresDb.transition_project has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncPostgresDb.get_tasks (cyclomatic 16) · ×1
  • AsyncPostgresDb.get_tasks (cyclomatic 16) libs/agno/agno/db/postgres/async_postgres.py:6925 — AsyncPostgresDb.get_tasks has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.get_runs (cyclomatic 16) · ×1
  • PostgresDb.get_runs (cyclomatic 16) libs/agno/agno/db/postgres/postgres.py:1204 — PostgresDb.get_runs has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.transition_project (cyclomatic 16) · ×1
  • PostgresDb.transition_project (cyclomatic 16) libs/agno/agno/db/postgres/postgres.py:9522 — PostgresDb.transition_project has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PostgresDb.get_tasks (cyclomatic 16) · ×1
  • PostgresDb.get_tasks (cyclomatic 16) libs/agno/agno/db/postgres/postgres.py:9660 — PostgresDb.get_tasks has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RedisDb.get_runs (cyclomatic 16) · ×1
  • RedisDb.get_runs (cyclomatic 16) libs/agno/agno/db/redis/redis.py:484 — RedisDb.get_runs has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RedisDb.upsert_session (cyclomatic 16) · ×1
  • RedisDb.upsert_session (cyclomatic 16) libs/agno/agno/db/redis/redis.py:857 — RedisDb.upsert_session has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SingleStoreDb.get_runs (cyclomatic 16) · ×1
  • SingleStoreDb.get_runs (cyclomatic 16) libs/agno/agno/db/singlestore/singlestore.py:783 — SingleStoreDb.get_runs has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SingleStoreDb.get_trace_stats (cyclomatic 16) · ×1
  • SingleStoreDb.get_trace_stats (cyclomatic 16) libs/agno/agno/db/singlestore/singlestore.py:3016 — SingleStoreDb.get_trace_stats has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_user_memories (cyclomatic 16) · ×1
  • AsyncSqliteDb.get_user_memories (cyclomatic 16) REDACTED:2209 — AsyncSqliteDb.get_user_memories has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AsyncSqliteDb.transition_project (cyclomatic 16) · ×1
  • AsyncSqliteDb.transition_project (cyclomatic 16) REDACTED:5948 — AsyncSqliteDb.transition_project has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AsyncSqliteDb.get_tasks (cyclomatic 16) · ×1
  • AsyncSqliteDb.get_tasks (cyclomatic 16) REDACTED:6094 — AsyncSqliteDb.get_tasks has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AsyncSqliteDb._get_table (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SqliteDb.transition_project (cyclomatic 16) · ×1
  • SqliteDb.transition_project (cyclomatic 16) REDACTED:8451 — SqliteDb.transition_project has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqliteDb.get_tasks (cyclomatic 16) · ×1
  • SqliteDb.get_tasks (cyclomatic 16) REDACTED:8589 — SqliteDb.get_tasks has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ValkeyDb.upsert_session (cyclomatic 16) · ×1
  • ValkeyDb.upsert_session (cyclomatic 16) libs/agno/agno/db/valkey/valkey.py:987 — ValkeyDb.upsert_session has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FileSystemTools.list_files (cyclomatic 16) · ×1
  • FileSystemTools.list_files (cyclomatic 16) libs/agno/agno/fs/toolkit.py:307 — FileSystemTools.list_files has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (FileSystemTools.alist_files) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · FileSystemTools.alist_files (cyclomatic 16) · ×1
  • FileSystemTools.alist_files (cyclomatic 16) libs/agno/agno/fs/toolkit.py:733 — FileSystemTools.alist_files has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (FileSystemTools.list_files) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Knowledge._update_content (cyclomatic 16) · ×1
  • Knowledge._update_content (cyclomatic 16) libs/agno/agno/knowledge/knowledge.py:4808 — Knowledge._update_content has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageCoordinator._embedding_pages (cyclomatic 16) · ×1
  • PageCoordinator._embedding_pages (cyclomatic 16) REDACTED:712 — PageCoordinator._embedding_pages has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageCoordinator.grep (cyclomatic 16) · ×1
  • PageCoordinator.grep (cyclomatic 16) REDACTED:1089 — PageCoordinator.grep has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CSVReader.read (cyclomatic 16) · ×1
  • CSVReader.read (cyclomatic 16) libs/agno/agno/knowledge/reader/csv_reader.py:66 — CSVReader.read has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FieldLabeledCSVReader.read (cyclomatic 16) · ×1
  • FieldLabeledCSVReader.read (cyclomatic 16) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:93 — FieldLabeledCSVReader.read has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LearningMachine._serialize_store_input (cyclomatic 16) · ×1
  • LearningMachine._serialize_store_input (cyclomatic 16) libs/agno/agno/learn/machine.py:1084 — LearningMachine._serialize_store_input has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LearningMachine._deserialize_store_config (cyclomatic 16) · ×1
  • LearningMachine._deserialize_store_config (cyclomatic 16) libs/agno/agno/learn/machine.py:1166 — LearningMachine._deserialize_store_config has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DecisionLogStore._filter_decisions (cyclomatic 16) · ×1
  • DecisionLogStore._filter_decisions (cyclomatic 16) libs/agno/agno/learn/stores/decision_log.py:824 — DecisionLogStore._filter_decisions has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model._populate_assistant_message_from_stream_data (cyclomatic 16) · ×1
  • Model._populate_assistant_message_from_stream_data (cyclomatic 16) REDACTED:1894 — Model._populate_assistant_message_from_stream_data has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HuggingFace.get_request_params (cyclomatic 16) · ×1
  • HuggingFace.get_request_params (cyclomatic 16) libs/agno/agno/models/huggingface/huggingface.py:123 — HuggingFace.get_request_params has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MoonShot._upload_media (cyclomatic 16) · ×1
  • MoonShot._upload_media (cyclomatic 16) libs/agno/agno/models/moonshot/moonshot.py:133 — MoonShot._upload_media has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OpenAIResponses.invoke_stream (cyclomatic 16) · ×1
  • OpenAIResponses.invoke_stream (cyclomatic 16) libs/agno/agno/models/openai/responses.py:1106 — OpenAIResponses.invoke_stream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (OpenAIResponses.ainvoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · OpenAIResponses.ainvoke_stream (cyclomatic 16) · ×1
  • OpenAIResponses.ainvoke_stream (cyclomatic 16) libs/agno/agno/models/openai/responses.py:1215 — OpenAIResponses.ainvoke_stream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (OpenAIResponses.invoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AgentOS._add_router (cyclomatic 16) · ×1
  • AgentOS._add_router (cyclomatic 16) libs/agno/agno/os/app.py:2611 — AgentOS._add_router has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · helpers.extract_message_payload (cyclomatic 16) · ×1
  • helpers.extract_message_payload (cyclomatic 16) libs/agno/agno/os/interfaces/telegram/helpers.py:57 — helpers.extract_message_payload has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · router.agent_resumable_response_streamer (cyclomatic 16) · ×1
  • router.agent_resumable_response_streamer (cyclomatic 16) libs/agno/agno/os/routers/agents/router.py:194 — router.agent_resumable_response_streamer has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandbox.enqueue_sandbox_run (cyclomatic 16) · ×1
  • sandbox.enqueue_sandbox_run (cyclomatic 16) libs/agno/agno/os/routers/agents/sandbox.py:16 — sandbox.enqueue_sandbox_run has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · components._resolve_member_links (cyclomatic 16) · ×1
  • components._resolve_member_links (cyclomatic 16) libs/agno/agno/os/routers/components/components.py:481 — components._resolve_member_links has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utils.run_agent_as_judge_eval (cyclomatic 16) · ×1
  • utils.run_agent_as_judge_eval (cyclomatic 16) libs/agno/agno/os/routers/evals/utils.py:56 — utils.run_agent_as_judge_eval has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · router._get_agent_filesystems (cyclomatic 16) · ×1
  • router._get_agent_filesystems (cyclomatic 16) libs/agno/agno/os/routers/filesystem/router.py:82 — router._get_agent_filesystems has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · router._get_global_filesystem_agent_ids (cyclomatic 16) · ×1
  • router._get_global_filesystem_agent_ids (cyclomatic 16) libs/agno/agno/os/routers/filesystem/router.py:283 — router._get_global_filesystem_agent_ids has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · router.workflow_continue_response_streamer (cyclomatic 16) · ×1
  • router.workflow_continue_response_streamer (cyclomatic 16) libs/agno/agno/os/routers/workflows/router.py:1330 — router.workflow_continue_response_streamer has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · openai.get_openai_reasoning_stream (cyclomatic 16) · ×1
  • openai.get_openai_reasoning_stream (cyclomatic 16) libs/agno/agno/reasoning/openai.py:120 — openai.get_openai_reasoning_stream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (openai.aget_openai_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · openai.aget_openai_reasoning_stream (cyclomatic 16) · ×1
  • openai.aget_openai_reasoning_stream (cyclomatic 16) libs/agno/agno/reasoning/openai.py:176 — openai.aget_openai_reasoning_stream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (openai.get_openai_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · Registry._rehydrate_function (cyclomatic 16) · ×1
  • Registry._rehydrate_function (cyclomatic 16) libs/agno/agno/registry/registry.py:368 — Registry._rehydrate_function has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · status_persist.persist_worker_owned_run (cyclomatic 16) · ×1
  • status_persist.persist_worker_owned_run (cyclomatic 16) libs/agno/agno/run/status_persist.py:337 — status_persist.persist_worker_owned_run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowSession.get_messages (cyclomatic 16) · ×1
  • WorkflowSession.get_messages (cyclomatic 16) libs/agno/agno/session/workflow.py:447 — WorkflowSession.get_messages has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _run.arun_dispatch (cyclomatic 16) · ×1
  • _run.arun_dispatch (cyclomatic 16) libs/agno/agno/team/_run.py:4131 — _run.arun_dispatch has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _run._truncate_team_run_to_checkpoint (cyclomatic 16) · ×1
  • _run._truncate_team_run_to_checkpoint (cyclomatic 16) libs/agno/agno/team/_run.py:6910 — _run._truncate_team_run_to_checkpoint has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolBridge._build (cyclomatic 16) · ×1
  • ToolBridge._build (cyclomatic 16) libs/agno/agno/tools/code/bridge.py:468 — ToolBridge._build has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolBridge._serve_results (cyclomatic 16) · ×1
  • ToolBridge._serve_results (cyclomatic 16) libs/agno/agno/tools/code/bridge.py:868 — ToolBridge._serve_results has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GoogleCalendarTools.update_event (cyclomatic 16) · ×1
  • GoogleCalendarTools.update_event (cyclomatic 16) libs/agno/agno/tools/google/calendar.py:348 — GoogleCalendarTools.update_event has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GoogleDriveTools.read_file (cyclomatic 16) · ×1
  • GoogleDriveTools.read_file (cyclomatic 16) libs/agno/agno/tools/google/drive.py:541 — GoogleDriveTools.read_file has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MCPTools.build_tools (cyclomatic 16) · ×1
  • MCPTools.build_tools (cyclomatic 16) libs/agno/agno/tools/mcp/mcp.py:886 — MCPTools.build_tools has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MemoryTools.__init__ (cyclomatic 16) · ×1
  • MemoryTools.__init__ (cyclomatic 16) libs/agno/agno/tools/memory.py:14 — MemoryTools.__init__ has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MLXTranscribeTools.transcribe (cyclomatic 16) · ×1
  • MLXTranscribeTools.transcribe (cyclomatic 16) libs/agno/agno/tools/mlx_transcribe.py:77 — MLXTranscribeTools.transcribe has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Neo4jTools.__init__ (cyclomatic 16) · ×1
  • Neo4jTools.__init__ (cyclomatic 16) libs/agno/agno/tools/neo4j.py:14 — Neo4jTools.__init__ has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · OpenBBTools.__init__ (cyclomatic 16) · ×1
  • OpenBBTools.__init__ (cyclomatic 16) libs/agno/agno/tools/openbb.py:15 — OpenBBTools.__init__ has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · RedmineTools.search_issues (cyclomatic 16) · ×1
  • RedmineTools.search_issues (cyclomatic 16) libs/agno/agno/tools/redmine.py:282 — RedmineTools.search_issues has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SixtyDBTools.__init__ (cyclomatic 16) · ×1
  • SixtyDBTools.__init__ (cyclomatic 16) libs/agno/agno/tools/sixtydb.py:84 — SixtyDBTools.__init__ has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools.create_team (cyclomatic 16) · ×1
  • StudioTools.create_team (cyclomatic 16) libs/agno/agno/tools/studio.py:2445 — StudioTools.create_team has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StudioTools._resolve_members (cyclomatic 16) · ×1
  • StudioTools._resolve_members (cyclomatic 16) libs/agno/agno/tools/studio.py:5043 — StudioTools._resolve_members has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StudioRunnerTools._require_registry_for (cyclomatic 16) · ×1
  • StudioRunnerTools._require_registry_for (cyclomatic 16) libs/agno/agno/tools/studio_runner.py:1091 — StudioRunnerTools._require_registry_for has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VisualizationTools.create_scatter_plot (cyclomatic 16) · ×1
  • VisualizationTools.create_scatter_plot (cyclomatic 16) libs/agno/agno/tools/visualization.py:305 — VisualizationTools.create_scatter_plot has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent.aget_last_run_output_util (cyclomatic 16) · ×1
  • agent.aget_last_run_output_util (cyclomatic 16) libs/agno/agno/utils/agent.py:937 — agent.aget_last_run_output_util has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · message.filter_tool_calls (cyclomatic 16) · ×1
  • message.filter_tool_calls (cyclomatic 16) libs/agno/agno/utils/message.py:110 — message.filter_tool_calls has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · openai.audio_to_message (cyclomatic 16) · ×1
  • openai.audio_to_message (cyclomatic 16) libs/agno/agno/utils/openai.py:10 — openai.audio_to_message has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · response.create_paused_run_output_panel (cyclomatic 16) · ×1
  • response.create_paused_run_output_panel (cyclomatic 16) libs/agno/agno/utils/response.py:81 — response.create_paused_run_output_panel has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · schema.annotation_reaches (cyclomatic 16) · ×1
  • schema.annotation_reaches (cyclomatic 16) libs/agno/agno/utils/schema.py:90 — schema.annotation_reaches has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChromaDb.async_insert (cyclomatic 16) · ×1
  • ChromaDb.async_insert (cyclomatic 16) REDACTED:454 — ChromaDb.async_insert has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ChromaDb._async_upsert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ChromaDb._async_upsert (cyclomatic 16) · ×1
  • ChromaDb._async_upsert (cyclomatic 16) REDACTED:655 — ChromaDb._async_upsert has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ChromaDb.async_insert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CouchbaseSearch.upsert (cyclomatic 16) · ×1
  • CouchbaseSearch.upsert (cyclomatic 16) REDACTED:446 — CouchbaseSearch.upsert has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MongoDb.async_insert (cyclomatic 16) · ×1
  • MongoDb.async_insert (cyclomatic 16) REDACTED:1141 — MongoDb.async_insert has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PineconeDb._prepare_vectors (cyclomatic 16) · ×1
  • PineconeDb._prepare_vectors (cyclomatic 16) REDACTED:370 — PineconeDb._prepare_vectors has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ValkeyDb._parse_hash (cyclomatic 16) · ×1
  • ValkeyDb._parse_hash (cyclomatic 16) libs/agno/agno/vectordb/valkey/valkeydb.py:322 — ValkeyDb._parse_hash has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Workflow._prepare_steps (cyclomatic 16) · ×1
  • Workflow._prepare_steps (cyclomatic 16) libs/agno/agno/workflow/workflow.py:11040 — Workflow._prepare_steps has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LoadBalancer._create (cyclomatic 16) · ×1
  • LoadBalancer._create (cyclomatic 16) libs/agno_infra/agno/aws/resource/elb/load_balancer.py:34 — LoadBalancer._create has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · mcp_client._verify_mcp (cyclomatic 16) · ×1
  • mcp_client._verify_mcp (cyclomatic 16) libs/agnoctl/agnoctl/mcp_client.py:84 — mcp_client._verify_mcp has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 02_tool_error_persistence.scenario_b_model_call_fails (cyclomatic 16) · ×1
  • 02_tool_error_persistence.scenario_b_model_call_fails (cyclomatic 16) cookbook/03_teams/23_checkpointing/02_tool_error_persistence.py:85 — 02_tool_error_persistence.scenario_b_model_call_fails has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · history_in_function.analyze_content_strategy (cyclomatic 16) · ×1
  • history_in_function.analyze_content_strategy (cyclomatic 16) cookbook/04_workflows/06_advanced_concepts/history/history_in_function.py:21 — history_in_function.analyze_content_strategy has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · cancel_run.long_running_task (cyclomatic 16) · ×1
  • cancel_run.long_running_task (cyclomatic 16) cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py:24 — cancel_run.long_running_task has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 01_step_confirmation_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 01_step_confirmation_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:92 — 01_step_confirmation_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 02_step_user_input_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 02_step_user_input_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/02_step_user_input_and_tool_confirmation.py:103 — 02_step_user_input_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 03_condition_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 03_condition_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:121 — 03_condition_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 04_router_selection_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 04_router_selection_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/04_router_selection_and_tool_confirmation.py:128 — 04_router_selection_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 05_output_review_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 05_output_review_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:85 — 05_output_review_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 06_loop_confirmation_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 06_loop_confirmation_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:104 — 06_loop_confirmation_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 07_router_confirmation_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) · ×1
  • 07_router_confirmation_and_tool_confirmation.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:122 — 07_router_confirmation_and_tool_confirmation.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 09_multi_step_mixed_hitl.resolve_executor_pause (cyclomatic 16) · ×1
  • 09_multi_step_mixed_hitl.resolve_executor_pause (cyclomatic 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:212 — 09_multi_step_mixed_hitl.resolve_executor_pause has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · team.aprint_response_stream (cognitive 371) · ×1
  • team.aprint_response_stream (cognitive 371) libs/agno/agno/utils/print_response/team.py:1292 — team.aprint_response_stream has cognitive complexity 371 (threshold 15). Drivers by points: if/else 86 (237 pts), loops 18 (61 pts), boolean chains 43, ternaries 5 (20 pts), error handling 2 (10 pts) (nesting depth added 217). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · team.print_response_stream (cognitive 349) · ×1
  • team.print_response_stream (cognitive 349) libs/agno/agno/utils/print_response/team.py:359 — team.print_response_stream has cognitive complexity 349 (threshold 15). Drivers by points: if/else 83 (222 pts), loops 17 (56 pts), boolean chains 41, ternaries 5 (20 pts), error handling 2 (10 pts) (nesting depth added 201). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _response._handle_model_response_chunk (cognitive 342) · ×1
  • _response._handle_model_response_chunk (cognitive 342) libs/agno/agno/team/_response.py:1311 — _response._handle_model_response_chunk has cognitive complexity 342 (threshold 15). Drivers by points: if/else 73 (272 pts), loops 8 (33 pts), ternaries 4 (20 pts), boolean chains 11, error handling 1 (6 pts) (nesting depth added 245). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._acontinue_run_stream (cognitive 336) · ×1
  • _run._acontinue_run_stream (cognitive 336) libs/agno/agno/team/_run.py:9803 — _run._acontinue_run_stream has cognitive complexity 336 (threshold 15). Drivers by points: if/else 76 (221 pts), loops 17 (59 pts), error handling 10 (27 pts), boolean chains 26, ternaries 2 (3 pts) (nesting depth added 205). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._acontinue_execute_stream (cognitive 334) · ×1
  • Workflow._acontinue_execute_stream (cognitive 334) libs/agno/agno/workflow/workflow.py:9566 — Workflow._acontinue_execute_stream has cognitive complexity 334 (threshold 15). Drivers by points: if/else 72 (202 pts), boolean chains 73, ternaries 9 (32 pts), loops 6 (15 pts), error handling 6 (12 pts) (nesting depth added 168). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._continue_execute_stream (cognitive 332) · ×1
  • Workflow._continue_execute_stream (cognitive 332) libs/agno/agno/workflow/workflow.py:7806 — Workflow._continue_execute_stream has cognitive complexity 332 (threshold 15). Drivers by points: if/else 71 (200 pts), boolean chains 73, ternaries 9 (32 pts), loops 6 (15 pts), error handling 6 (12 pts) (nesting depth added 167). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Step.aexecute_stream (cognitive 289) · ×1
  • Step.aexecute_stream (cognitive 289) libs/agno/agno/workflow/step.py:2080 — Step.aexecute_stream has cognitive complexity 289 (threshold 15). Drivers by points: if/else 59 (202 pts), boolean chains 33, ternaries 9 (31 pts), loops 5 (17 pts), error handling 3 (6 pts) (nesting depth added 180). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _response.handle_model_response_chunk (cognitive 288) · ×1
  • _response.handle_model_response_chunk (cognitive 288) libs/agno/agno/agent/_response.py:1359 — _response.handle_model_response_chunk has cognitive complexity 288 (threshold 15). Drivers by points: if/else 62 (227 pts), loops 8 (34 pts), boolean chains 11, ternaries 2 (10 pts), error handling 1 (6 pts) (nesting depth added 204). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._aexecute_stream (cognitive 281) · ×1
  • Workflow._aexecute_stream (cognitive 281) libs/agno/agno/workflow/workflow.py:4279 — Workflow._aexecute_stream has cognitive complexity 281 (threshold 15). Drivers by points: if/else 49 (150 pts), boolean chains 45, ternaries 8 (32 pts), error handling 11 (30 pts), loops 8 (24 pts) (nesting depth added 160). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Step.execute_stream (cognitive 261) · ×1
  • Step.execute_stream (cognitive 261) libs/agno/agno/workflow/step.py:1418 — Step.execute_stream has cognitive complexity 261 (threshold 15). Drivers by points: if/else 52 (174 pts), boolean chains 33, ternaries 9 (31 pts), loops 4 (13 pts), error handling 4 (10 pts) (nesting depth added 159). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · utils.stream_a2a_response (cognitive 256) · ×1
  • utils.stream_a2a_response (cognitive 256) libs/agno/agno/os/interfaces/a2a/utils.py:304 — utils.stream_a2a_response has cognitive complexity 256 (threshold 15). Drivers by points: if/else 66 (179 pts), boolean chains 54, ternaries 6 (13 pts), loops 4 (10 pts) (nesting depth added 126). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.print_response_stream (cognitive 254) · ×1
  • workflow.print_response_stream (cognitive 254) libs/agno/agno/utils/print_response/workflow.py:195 — workflow.print_response_stream has cognitive complexity 254 (threshold 15). Drivers by points: if/else 48 (127 pts), ternaries 16 (61 pts), boolean chains 51, loops 4 (14 pts), error handling 1 (nesting depth added 134). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · workflow.aprint_response_stream (cognitive 247) · ×1
  • workflow.aprint_response_stream (cognitive 247) libs/agno/agno/utils/print_response/workflow.py:1056 — workflow.aprint_response_stream has cognitive complexity 247 (threshold 15). Drivers by points: if/else 47 (121 pts), ternaries 16 (61 pts), boolean chains 50, loops 4 (14 pts), error handling 1 (nesting depth added 129). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._execute_stream (cognitive 246) · ×1
  • Workflow._execute_stream (cognitive 246) libs/agno/agno/workflow/workflow.py:3275 — Workflow._execute_stream has cognitive complexity 246 (threshold 15). Drivers by points: if/else 42 (125 pts), boolean chains 43, ternaries 8 (32 pts), error handling 10 (25 pts), loops 7 (21 pts) (nesting depth added 136). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Step.aexecute (cognitive 236) · ×1
  • Step.aexecute (cognitive 236) libs/agno/agno/workflow/step.py:1777 — Step.aexecute has cognitive complexity 236 (threshold 15). Drivers by points: if/else 50 (166 pts), ternaries 9 (31 pts), boolean chains 18, loops 3 (11 pts), error handling 4 (10 pts) (nesting depth added 152). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._acontinue_run_stream (cognitive 234) · ×1
  • _run._acontinue_run_stream (cognitive 234) libs/agno/agno/agent/_run.py:5190 — _run._acontinue_run_stream has cognitive complexity 234 (threshold 15). Drivers by points: if/else 59 (160 pts), loops 9 (22 pts), error handling 8 (21 pts), boolean chains 16, ternaries 7 (15 pts) (nesting depth added 135). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model.arun_function_calls (cognitive 224) · ×1
  • Model.arun_function_calls (cognitive 224) REDACTED:2623 — Model.arun_function_calls has cognitive complexity 224 (threshold 15). Drivers by points: if/else 55 (169 pts), loops 12 (27 pts), boolean chains 20, error handling 3 (8 pts) (nesting depth added 134). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Step.from_dict (cognitive 220) · ×1
  • Step.from_dict (cognitive 220) libs/agno/agno/workflow/step.py:328 — Step.from_dict has cognitive complexity 220 (threshold 15). Drivers by points: if/else 50 (153 pts), error handling 10 (38 pts), boolean chains 26, ternaries 2 (3 pts) (nesting depth added 132). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._acontinue_execute (cognitive 211) · ×1
  • Workflow._acontinue_execute (cognitive 211) libs/agno/agno/workflow/workflow.py:9025 — Workflow._acontinue_execute has cognitive complexity 211 (threshold 15). Drivers by points: if/else 54 (131 pts), boolean chains 52, ternaries 6 (18 pts), error handling 6 (9 pts), loops 1 (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._continue_execute (cognitive 208) · ×1
  • Workflow._continue_execute (cognitive 208) libs/agno/agno/workflow/workflow.py:6963 — Workflow._continue_execute has cognitive complexity 208 (threshold 15). Drivers by points: if/else 51 (128 pts), boolean chains 53, ternaries 6 (18 pts), error handling 5 (8 pts), loops 1 (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Step.execute (cognitive 197) · ×1
  • Step.execute (cognitive 197) libs/agno/agno/workflow/step.py:1094 — Step.execute has cognitive complexity 197 (threshold 15). Drivers by points: if/else 43 (134 pts), ternaries 9 (31 pts), boolean chains 17, error handling 4 (10 pts), loops 2 (5 pts) (nesting depth added 122). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _storage.to_dict (cognitive 193) · ×1
  • _storage.to_dict (cognitive 193) libs/agno/agno/agent/_storage.py:833 — _storage.to_dict has cognitive complexity 193 (threshold 15). Drivers by points: if/else 123 (162 pts), boolean chains 11, loops 4 (10 pts), ternaries 3 (7 pts), error handling 1 (3 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._parse_provider_response (cognitive 185) · ×1
  • GeminiInteractions._parse_provider_response (cognitive 185) libs/agno/agno/models/google/gemini_interactions.py:782 — GeminiInteractions._parse_provider_response has cognitive complexity 185 (threshold 15). Drivers by points: if/else 37 (144 pts), loops 5 (18 pts), boolean chains 15, ternaries 2 (8 pts) (nesting depth added 126). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · team.print_response (cognitive 184) · ×1
  • team.print_response (cognitive 184) libs/agno/agno/utils/print_response/team.py:22 — team.print_response has cognitive complexity 184 (threshold 15). Drivers by points: if/else 40 (116 pts), loops 9 (36 pts), boolean chains 21, ternaries 2 (11 pts) (nesting depth added 112). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · team.aprint_response (cognitive 179) · ×1
  • team.aprint_response (cognitive 179) libs/agno/agno/utils/print_response/team.py:957 — team.aprint_response has cognitive complexity 179 (threshold 15). Drivers by points: if/else 39 (111 pts), loops 9 (36 pts), boolean chains 21, ternaries 2 (11 pts) (nesting depth added 108). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._arun_stream (cognitive 178) · ×1
  • _run._arun_stream (cognitive 178) libs/agno/agno/agent/_run.py:2123 — _run._arun_stream has cognitive complexity 178 (threshold 15). Drivers by points: if/else 46 (117 pts), loops 13 (33 pts), error handling 8 (18 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 102). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage.to_dict (cognitive 173) · ×1
  • _storage.to_dict (cognitive 173) libs/agno/agno/team/_storage.py:513 — _storage.to_dict has cognitive complexity 173 (threshold 15). Drivers by points: if/else 120 (145 pts), boolean chains 10, loops 3 (8 pts), ternaries 3 (7 pts), error handling 1 (3 pts) (nesting depth added 36). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _run._acontinue_run (cognitive 172) · ×1
  • _run._acontinue_run (cognitive 172) libs/agno/agno/team/_run.py:9323 — _run._acontinue_run has cognitive complexity 172 (threshold 15). Drivers by points: if/else 45 (117 pts), boolean chains 24, error handling 9 (24 pts), loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 90). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage.from_dict (cognitive 166) · ×1
  • _storage.from_dict (cognitive 166) libs/agno/agno/team/_storage.py:955 — _storage.from_dict has cognitive complexity 166 (threshold 15). Drivers by points: if/else 45 (113 pts), ternaries 7 (24 pts), boolean chains 18, error handling 2 (8 pts), loops 2 (3 pts) (nesting depth added 92). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · claude.format_messages (cognitive 164) · ×1
  • claude.format_messages (cognitive 164) libs/agno/agno/utils/models/claude.py:609 — claude.format_messages has cognitive complexity 164 (threshold 15). Drivers by points: if/else 33 (111 pts), loops 8 (29 pts), boolean chains 12, ternaries 3 (12 pts) (nesting depth added 108). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _commands._cmd_rg (cognitive 160) · ×1
  • _commands._cmd_rg (cognitive 160) libs/agno/agno/knowledge/page/_commands.py:401 — _commands._cmd_rg has cognitive complexity 160 (threshold 15). Drivers by points: if/else 43 (107 pts), ternaries 9 (24 pts), loops 6 (15 pts), boolean chains 11, error handling 2 (3 pts) (nesting depth added 89). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._acontinue_run (cognitive 158) · ×1
  • _run._acontinue_run (cognitive 158) libs/agno/agno/agent/_run.py:4668 — _run._acontinue_run has cognitive complexity 158 (threshold 15). Drivers by points: if/else 39 (103 pts), error handling 8 (21 pts), ternaries 7 (16 pts), boolean chains 14, loops 2 (4 pts) (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemini._parse_provider_response (cognitive 157) · ×1
  • Gemini._parse_provider_response (cognitive 157) libs/agno/agno/models/google/gemini.py:1225 — Gemini._parse_provider_response has cognitive complexity 157 (threshold 15). Drivers by points: if/else 40 (116 pts), boolean chains 20, ternaries 3 (13 pts), loops 3 (8 pts) (nesting depth added 91). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _tools._determine_tools_for_model (cognitive 155) · ×1
  • _tools._determine_tools_for_model (cognitive 155) libs/agno/agno/team/_tools.py:113 — _tools._determine_tools_for_model has cognitive complexity 155 (threshold 15). Drivers by points: if/else 40 (90 pts), ternaries 14 (34 pts), boolean chains 20, loops 4 (8 pts), error handling 1 (3 pts) (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._run_stream (cognitive 152) · ×1
  • _run._run_stream (cognitive 152) libs/agno/agno/agent/_run.py:777 — _run._run_stream has cognitive complexity 152 (threshold 15). Drivers by points: if/else 40 (102 pts), loops 9 (21 pts), error handling 8 (20 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 87). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._parse_provider_response_delta (cognitive 150) · ×1
  • GeminiInteractions._parse_provider_response_delta (cognitive 150) libs/agno/agno/models/google/gemini_interactions.py:953 — GeminiInteractions._parse_provider_response_delta has cognitive complexity 150 (threshold 15). Drivers by points: if/else 35 (101 pts), ternaries 6 (22 pts), boolean chains 21, error handling 1 (4 pts), loops 1 (2 pts) (nesting depth added 86). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._aexecute (cognitive 149) · ×1
  • Workflow._aexecute (cognitive 149) libs/agno/agno/workflow/workflow.py:3916 — Workflow._aexecute has cognitive complexity 149 (threshold 15). Drivers by points: if/else 32 (82 pts), boolean chains 23, error handling 7 (17 pts), ternaries 4 (15 pts), loops 4 (12 pts) (nesting depth added 79). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Model.response (cognitive 148) · ×1
  • Model.response (cognitive 148) REDACTED:651 — Model.response has cognitive complexity 148 (threshold 15). Drivers by points: if/else 30 (119 pts), boolean chains 12, loops 3 (7 pts), ternaries 4 (6 pts), error handling 1 (4 pts) (nesting depth added 98). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (Model.aresponse) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Model.aresponse (cognitive 148) · ×1
  • Model.aresponse (cognitive 148) REDACTED:884 — Model.aresponse has cognitive complexity 148 (threshold 15). Drivers by points: if/else 30 (119 pts), boolean chains 12, loops 3 (7 pts), ternaries 4 (6 pts), error handling 1 (4 pts) (nesting depth added 98). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (Model.response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Gemini._format_messages (cognitive 144) · ×1
  • Gemini._format_messages (cognitive 144) libs/agno/agno/models/google/gemini.py:778 — Gemini._format_messages has cognitive complexity 144 (threshold 15). Drivers by points: if/else 26 (90 pts), loops 7 (21 pts), boolean chains 13, error handling 3 (12 pts), ternaries 2 (8 pts) (nesting depth added 93). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Gemini._parse_provider_response_delta (cognitive 143) · ×1
  • Gemini._parse_provider_response_delta (cognitive 143) libs/agno/agno/models/google/gemini.py:1399 — Gemini._parse_provider_response_delta has cognitive complexity 143 (threshold 15). Drivers by points: if/else 30 (102 pts), boolean chains 17, ternaries 3 (15 pts), loops 3 (9 pts) (nesting depth added 90). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._execute (cognitive 142) · ×1
  • Workflow._execute (cognitive 142) libs/agno/agno/workflow/workflow.py:2927 — Workflow._execute has cognitive complexity 142 (threshold 15). Drivers by points: if/else 29 (74 pts), boolean chains 23, error handling 9 (21 pts), ternaries 4 (15 pts), loops 3 (9 pts) (nesting depth added 74). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._arun_stream (cognitive 135) · ×1
  • _run._arun_stream (cognitive 135) libs/agno/agno/team/_run.py:3616 — _run._arun_stream has cognitive complexity 135 (threshold 15). Drivers by points: if/else 34 (85 pts), loops 12 (29 pts), error handling 8 (18 pts), boolean chains 3 (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.acontinue_run (cognitive 133) · ×1
  • Workflow.acontinue_run (cognitive 133) libs/agno/agno/workflow/workflow.py:8617 — Workflow.acontinue_run has cognitive complexity 133 (threshold 15). Drivers by points: if/else 52 (96 pts), boolean chains 28, loops 5 (6 pts), ternaries 3 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._arun_tasks_stream (cognitive 128) · ×1
  • _run._arun_tasks_stream (cognitive 128) libs/agno/agno/team/_run.py:2490 — _run._arun_tasks_stream has cognitive complexity 128 (threshold 15). Drivers by points: if/else 45 (91 pts), loops 10 (20 pts), error handling 8 (12 pts), boolean chains 5 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.continue_run (cognitive 127) · ×1
  • Workflow.continue_run (cognitive 127) libs/agno/agno/workflow/workflow.py:6580 — Workflow.continue_run has cognitive complexity 127 (threshold 15). Drivers by points: if/else 50 (93 pts), boolean chains 26, loops 5 (6 pts), ternaries 2 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run.continue_run_dispatch (cognitive 124) · ×1
  • _run.continue_run_dispatch (cognitive 124) libs/agno/agno/team/_run.py:7375 — _run.continue_run_dispatch has cognitive complexity 124 (threshold 15). Drivers by points: if/else 49 (68 pts), boolean chains 38, ternaries 7 (10 pts), error handling 3 (8 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsResources.create_resources (cognitive 123) · ×1
  • AwsResources.create_resources (cognitive 123) libs/agno_infra/agno/aws/resources.py:73 — AwsResources.create_resources has cognitive complexity 123 (threshold 15). Drivers by points: if/else 29 (83 pts), loops 12 (33 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · trace_to_database.run_trace_demo (cognitive 123) · ×1
  • trace_to_database.run_trace_demo (cognitive 123) cookbook/observability/trace_to_database.py:43 — trace_to_database.run_trace_demo has cognitive complexity 123 (threshold 15). Drivers by points: if/else 26 (92 pts), ternaries 3 (11 pts), boolean chains 10, loops 3 (9 pts), error handling 1 (nesting depth added 80). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DockerResources.create_resources (cognitive 122) · ×1
  • DockerResources.create_resources (cognitive 122) libs/agno_infra/agno/docker/resources.py:31 — DockerResources.create_resources has cognitive complexity 122 (threshold 15). Drivers by points: if/else 28 (82 pts), loops 12 (33 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 76). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Claude._parse_provider_response (cognitive 120) · ×1
  • Claude._parse_provider_response (cognitive 120) libs/agno/agno/models/anthropic/claude.py:968 — Claude._parse_provider_response has cognitive complexity 120 (threshold 15). Drivers by points: if/else 25 (75 pts), error handling 3 (18 pts), loops 5 (17 pts), boolean chains 10 (nesting depth added 77). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _messages.aget_system_message (cognitive 117) · ×1
  • _messages.aget_system_message (cognitive 117) libs/agno/agno/agent/_messages.py:1213 — _messages.aget_system_message has cognitive complexity 117 (threshold 15). Drivers by points: if/else 54 (81 pts), ternaries 9 (14 pts), boolean chains 12, loops 3 (7 pts), error handling 1 (3 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Claude._parse_provider_response_delta (cognitive 114) · ×1
  • Claude._parse_provider_response_delta (cognitive 114) libs/agno/agno/models/anthropic/claude.py:1114 — Claude._parse_provider_response_delta has cognitive complexity 114 (threshold 15). Drivers by points: if/else 27 (75 pts), loops 4 (15 pts), error handling 4 (13 pts), boolean chains 11 (nesting depth added 68). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _messages.get_system_message (cognitive 112) · ×1
  • _messages.get_system_message (cognitive 112) libs/agno/agno/agent/_messages.py:917 — _messages.get_system_message has cognitive complexity 112 (threshold 15). Drivers by points: if/else 51 (75 pts), ternaries 9 (15 pts), boolean chains 12, loops 3 (7 pts), error handling 1 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS.get_app (cognitive 111) · ×1
  • AgentOS.get_app (cognitive 111) libs/agno/agno/os/app.py:1753 — AgentOS.get_app has cognitive complexity 111 (threshold 15). Drivers by points: if/else 47 (73 pts), boolean chains 18, ternaries 6 (9 pts), error handling 2 (7 pts), loops 3 (4 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model.aresponse_stream (cognitive 109) · ×1
  • Model.aresponse_stream (cognitive 109) REDACTED:1648 — Model.aresponse_stream has cognitive complexity 109 (threshold 15). Drivers by points: if/else 23 (58 pts), ternaries 11 (20 pts), boolean chains 14, loops 5 (13 pts), error handling 1 (4 pts) (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._run_stream (cognitive 109) · ×1
  • _run._run_stream (cognitive 109) libs/agno/agno/team/_run.py:1442 — _run._run_stream has cognitive complexity 109 (threshold 15). Drivers by points: if/else 29 (73 pts), error handling 8 (20 pts), loops 6 (14 pts), boolean chains 2 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model.response_stream (cognitive 108) · ×1
  • Model.response_stream (cognitive 108) REDACTED:1367 — Model.response_stream has cognitive complexity 108 (threshold 15). Drivers by points: if/else 23 (58 pts), ternaries 11 (20 pts), boolean chains 13, loops 5 (13 pts), error handling 1 (4 pts) (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._run_tasks_stream (cognitive 106) · ×1
  • _run._run_tasks_stream (cognitive 106) libs/agno/agno/team/_run.py:575 — _run._run_tasks_stream has cognitive complexity 106 (threshold 15). Drivers by points: if/else 37 (76 pts), error handling 8 (13 pts), loops 6 (13 pts), boolean chains 4 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsBedrock._format_messages (cognitive 105) · ×1
  • AwsBedrock._format_messages (cognitive 105) libs/agno/agno/models/aws/bedrock.py:334 — AwsBedrock._format_messages has cognitive complexity 105 (threshold 15). Drivers by points: if/else 23 (80 pts), loops 5 (17 pts), error handling 1 (5 pts), boolean chains 3 (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SecurityGroup.add_inbound_rules (cognitive 105) · ×1
  • SecurityGroup.add_inbound_rules (cognitive 105) libs/agno_infra/agno/aws/resource/ec2/security_group.py:330 — SecurityGroup.add_inbound_rules has cognitive complexity 105 (threshold 15). Drivers by points: if/else 25 (78 pts), error handling 6 (18 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AuthMiddleware._dispatch (cognitive 104) · ×1
  • AuthMiddleware._dispatch (cognitive 104) libs/agno/agno/os/middleware/jwt.py:1464 — AuthMiddleware._dispatch has cognitive complexity 104 (threshold 15). Drivers by points: if/else 41 (68 pts), boolean chains 18, ternaries 3 (8 pts), error handling 5 (6 pts), loops 2 (4 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.print_response_stream (cognitive 103) · ×1
  • agent.print_response_stream (cognitive 103) libs/agno/agno/utils/print_response/agent.py:28 — agent.print_response_stream has cognitive complexity 103 (threshold 15). Drivers by points: if/else 28 (72 pts), error handling 3 (18 pts), boolean chains 12, loops 1 (nesting depth added 59). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ReasoningManager.stream_native_reasoning (cognitive 102) · ×1
  • ReasoningManager.stream_native_reasoning (cognitive 102) libs/agno/agno/reasoning/manager.py:379 — ReasoningManager.stream_native_reasoning has cognitive complexity 102 (threshold 15). Drivers by points: if/else 39 (84 pts), loops 9 (18 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ReasoningManager.astream_native_reasoning) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ReasoningManager.astream_native_reasoning (cognitive 102) · ×1
  • ReasoningManager.astream_native_reasoning (cognitive 102) libs/agno/agno/reasoning/manager.py:619 — ReasoningManager.astream_native_reasoning has cognitive complexity 102 (threshold 15). Drivers by points: if/else 39 (84 pts), loops 9 (18 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ReasoningManager.stream_native_reasoning) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._continue_run_stream (cognitive 101) · ×1
  • _run._continue_run_stream (cognitive 101) libs/agno/agno/team/_run.py:8365 — _run._continue_run_stream has cognitive complexity 101 (threshold 15). Drivers by points: if/else 26 (70 pts), error handling 7 (17 pts), loops 5 (13 pts), boolean chains 1 (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseRunOutputEvent.to_dict (cognitive 99) · ×1
  • BaseRunOutputEvent.to_dict (cognitive 99) libs/agno/agno/run/base.py:107 — BaseRunOutputEvent.to_dict has cognitive complexity 99 (threshold 15). Drivers by points: if/else 45 (60 pts), boolean chains 24, loops 6 (11 pts), ternaries 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemini.convert_schema (cognitive 99) · ×1
  • gemini.convert_schema (cognitive 99) libs/agno/agno/utils/gemini.py:223 — gemini.convert_schema has cognitive complexity 99 (threshold 15). Drivers by points: if/else 38 (76 pts), boolean chains 8, ternaries 2 (8 pts), loops 3 (7 pts) (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Loop.execute_stream (cognitive 99) · ×1
  • Loop.execute_stream (cognitive 99) libs/agno/agno/workflow/loop.py:583 — Loop.execute_stream has cognitive complexity 99 (threshold 15). Drivers by points: if/else 21 (51 pts), boolean chains 24, loops 6 (15 pts), ternaries 4 (9 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Loop.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Loop.aexecute_stream (cognitive 99) · ×1
  • Loop.aexecute_stream (cognitive 99) libs/agno/agno/workflow/loop.py:980 — Loop.aexecute_stream has cognitive complexity 99 (threshold 15). Drivers by points: if/else 21 (51 pts), boolean chains 24, loops 6 (15 pts), ternaries 4 (9 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Loop.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RunRequirement.from_dict (cognitive 97) · ×1
  • RunRequirement.from_dict (cognitive 97) libs/agno/agno/run/requirement.py:232 — RunRequirement.from_dict has cognitive complexity 97 (threshold 15). Drivers by points: if/else 26 (65 pts), loops 5 (19 pts), boolean chains 7, ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 56). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _tools.parse_tools (cognitive 96) · ×1
  • _tools.parse_tools (cognitive 96) libs/agno/agno/agent/_tools.py:473 — _tools.parse_tools has cognitive complexity 96 (threshold 15). Drivers by points: if/else 20 (64 pts), ternaries 5 (14 pts), boolean chains 11, loops 2 (4 pts), error handling 1 (3 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.upsert_sessions (cognitive 96) · ×1
  • PostgresDb.upsert_sessions (cognitive 96) libs/agno/agno/db/postgres/postgres.py:2158 — PostgresDb.upsert_sessions has cognitive complexity 96 (threshold 15). Drivers by points: if/else 32 (74 pts), loops 6 (12 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.upsert_config (cognitive 96) · ×1
  • PostgresDb.upsert_config (cognitive 96) libs/agno/agno/db/postgres/postgres.py:5486 — PostgresDb.upsert_config has cognitive complexity 96 (threshold 15). Drivers by points: if/else 40 (74 pts), boolean chains 7, loops 3 (7 pts), ternaries 3 (5 pts), error handling 2 (3 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.upsert_config (cognitive 96) · ×1
  • SqliteDb.upsert_config (cognitive 96) REDACTED:5289 — SqliteDb.upsert_config has cognitive complexity 96 (threshold 15). Drivers by points: if/else 40 (74 pts), boolean chains 7, loops 3 (7 pts), ternaries 3 (5 pts), error handling 2 (3 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueWorker._execute_claimed_inner (cognitive 94) · ×1
  • QueueWorker._execute_claimed_inner (cognitive 94) libs/agno/agno/os/job_queue.py:2107 — QueueWorker._execute_claimed_inner has cognitive complexity 94 (threshold 15). Drivers by points: if/else 36 (59 pts), error handling 9 (16 pts), boolean chains 12, ternaries 3 (7 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamSession.get_messages (cognitive 94) · ×1
  • TeamSession.get_messages (cognitive 94) libs/agno/agno/session/team.py:130 — TeamSession.get_messages has cognitive complexity 94 (threshold 15). Drivers by points: if/else 29 (65 pts), loops 7 (18 pts), boolean chains 11 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.aprint_response_stream (cognitive 94) · ×1
  • agent.aprint_response_stream (cognitive 94) libs/agno/agno/utils/print_response/agent.py:235 — agent.aprint_response_stream has cognitive complexity 94 (threshold 15). Drivers by points: if/else 27 (66 pts), error handling 3 (15 pts), boolean chains 12, loops 1 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · prompts.get_json_output_prompt (cognitive 94) · ×1
  • prompts.get_json_output_prompt (cognitive 94) libs/agno/agno/utils/prompts.py:9 — prompts.get_json_output_prompt has cognitive complexity 94 (threshold 15). Drivers by points: if/else 17 (74 pts), loops 3 (18 pts), boolean chains 2 (nesting depth added 72). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Condition.execute_stream (cognitive 94) · ×1
  • Condition.execute_stream (cognitive 94) libs/agno/agno/workflow/condition.py:659 — Condition.execute_stream has cognitive complexity 94 (threshold 15). Drivers by points: if/else 25 (50 pts), boolean chains 30, error handling 3 (6 pts), ternaries 3 (5 pts), loops 2 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Condition.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Condition.aexecute_stream (cognitive 94) · ×1
  • Condition.aexecute_stream (cognitive 94) libs/agno/agno/workflow/condition.py:1112 — Condition.aexecute_stream has cognitive complexity 94 (threshold 15). Drivers by points: if/else 25 (50 pts), boolean chains 30, error handling 3 (6 pts), ternaries 3 (5 pts), loops 2 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Condition.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Message.from_dict (cognitive 93) · ×1
  • Message.from_dict (cognitive 93) libs/agno/agno/models/message.py:149 — Message.from_dict has cognitive complexity 93 (threshold 15). Drivers by points: if/else 34 (64 pts), boolean chains 21, loops 4 (8 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PublicMiddleware.__call__ (cognitive 93) · ×1
  • PublicMiddleware.__call__ (cognitive 93) libs/agno/agno/os/public/_middleware.py:219 — PublicMiddleware.__call__ has cognitive complexity 93 (threshold 15). Drivers by points: if/else 35 (49 pts), boolean chains 20, ternaries 12 (19 pts), error handling 4 (5 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SecurityGroup.add_outbound_rules (cognitive 91) · ×1
  • SecurityGroup.add_outbound_rules (cognitive 91) libs/agno_infra/agno/aws/resource/ec2/security_group.py:465 — SecurityGroup.add_outbound_rules has cognitive complexity 91 (threshold 15). Drivers by points: if/else 22 (65 pts), error handling 6 (18 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsResources.delete_resources (cognitive 91) · ×1
  • AwsResources.delete_resources (cognitive 91) libs/agno_infra/agno/aws/resources.py:236 — AwsResources.delete_resources has cognitive complexity 91 (threshold 15). Drivers by points: if/else 26 (61 pts), loops 11 (23 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._arun (cognitive 90) · ×1
  • _run._arun (cognitive 90) libs/agno/agno/agent/_run.py:1513 — _run._arun has cognitive complexity 90 (threshold 15). Drivers by points: if/else 24 (55 pts), error handling 8 (18 pts), loops 3 (7 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeAgent._arun_adapter_stream (cognitive 89) · ×1
  • ClaudeAgent._arun_adapter_stream (cognitive 89) libs/agno/agno/agents/claude/agent.py:1138 — ClaudeAgent._arun_adapter_stream has cognitive complexity 89 (threshold 15). Drivers by points: if/else 16 (62 pts), ternaries 2 (13 pts), loops 3 (8 pts), boolean chains 6 (nesting depth added 62). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AsyncSqliteDb.upsert_sessions (cognitive 89) · ×1
  • AsyncSqliteDb.upsert_sessions (cognitive 89) REDACTED:1806 — AsyncSqliteDb.upsert_sessions has cognitive complexity 89 (threshold 15). Drivers by points: if/else 25 (63 pts), loops 7 (16 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SqliteDb.upsert_sessions (cognitive 89) · ×1
  • SqliteDb.upsert_sessions (cognitive 89) REDACTED:2063 — SqliteDb.upsert_sessions has cognitive complexity 89 (threshold 15). Drivers by points: if/else 25 (63 pts), loops 7 (16 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Model.run_function_call (cognitive 89) · ×1
  • Model.run_function_call (cognitive 89) REDACTED:2232 — Model.run_function_call has cognitive complexity 89 (threshold 15). Drivers by points: if/else 27 (72 pts), boolean chains 8, error handling 5 (7 pts), loops 1 (2 pts) (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · utils.get_request_kwargs (cognitive 89) · ×1
  • utils.get_request_kwargs (cognitive 89) libs/agno/agno/os/utils.py:141 — utils.get_request_kwargs has cognitive complexity 89 (threshold 15). Drivers by points: if/else 27 (50 pts), error handling 8 (17 pts), boolean chains 9, ternaries 3 (7 pts), loops 3 (6 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages.aget_system_message (cognitive 89) · ×1
  • _messages.aget_system_message (cognitive 89) libs/agno/agno/team/_messages.py:684 — _messages.aget_system_message has cognitive complexity 89 (threshold 15). Drivers by points: if/else 37 (62 pts), ternaries 9 (15 pts), boolean chains 6, error handling 1 (3 pts), loops 1 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DockerResources.delete_resources (cognitive 88) · ×1
  • DockerResources.delete_resources (cognitive 88) libs/agno_infra/agno/docker/resources.py:191 — DockerResources.delete_resources has cognitive complexity 88 (threshold 15). Drivers by points: if/else 24 (58 pts), loops 11 (23 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · connect._connect (cognitive 88) · ×1
  • connect._connect (cognitive 88) libs/agnoctl/agnoctl/commands/connect.py:338 — connect._connect has cognitive complexity 88 (threshold 15). Drivers by points: if/else 29 (45 pts), boolean chains 18, ternaries 9 (17 pts), error handling 3 (6 pts), loops 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleToolkit._resolve_creds (cognitive 87) · ×1
  • GoogleToolkit._resolve_creds (cognitive 87) libs/agno/agno/tools/google/base.py:173 — GoogleToolkit._resolve_creds has cognitive complexity 87 (threshold 15). Drivers by points: if/else 31 (59 pts), boolean chains 16, error handling 4 (12 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._continue_run_stream (cognitive 86) · ×1
  • _run._continue_run_stream (cognitive 86) libs/agno/agno/agent/_run.py:3876 — _run._continue_run_stream has cognitive complexity 86 (threshold 15). Drivers by points: if/else 22 (56 pts), error handling 7 (17 pts), loops 5 (9 pts), boolean chains 4 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage.from_dict (cognitive 86) · ×1
  • _storage.from_dict (cognitive 86) libs/agno/agno/agent/_storage.py:1226 — _storage.from_dict has cognitive complexity 86 (threshold 15). Drivers by points: if/else 32 (59 pts), boolean chains 13, ternaries 5 (10 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._build_input (cognitive 86) · ×1
  • GeminiInteractions._build_input (cognitive 86) libs/agno/agno/models/google/gemini_interactions.py:351 — GeminiInteractions._build_input has cognitive complexity 86 (threshold 15). Drivers by points: if/else 16 (54 pts), loops 6 (21 pts), error handling 1 (6 pts), boolean chains 5 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages.get_system_message (cognitive 86) · ×1
  • _messages.get_system_message (cognitive 86) libs/agno/agno/team/_messages.py:426 — _messages.get_system_message has cognitive complexity 86 (threshold 15). Drivers by points: if/else 35 (58 pts), ternaries 9 (16 pts), boolean chains 6, error handling 1 (3 pts), loops 1 (3 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Message.log (cognitive 84) · ×1
  • Message.log (cognitive 84) libs/agno/agno/models/message.py:368 — Message.log has cognitive complexity 84 (threshold 15). Drivers by points: if/else 29 (51 pts), boolean chains 15, ternaries 4 (11 pts), error handling 2 (5 pts), loops 1 (2 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · message.reformat_tool_call_ids (cognitive 84) · ×1
  • message.reformat_tool_call_ids (cognitive 84) libs/agno/agno/utils/message.py:203 — message.reformat_tool_call_ids has cognitive complexity 84 (threshold 15). Drivers by points: if/else 17 (55 pts), boolean chains 10, ternaries 2 (10 pts), loops 4 (9 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AwsResources.update_resources (cognitive 84) · ×1
  • AwsResources.update_resources (cognitive 84) libs/agno_infra/agno/aws/resources.py:391 — AwsResources.update_resources has cognitive complexity 84 (threshold 15). Drivers by points: if/else 25 (57 pts), loops 10 (20 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DockerResources.update_resources (cognitive 83) · ×1
  • DockerResources.update_resources (cognitive 83) libs/agno_infra/agno/docker/resources.py:355 — DockerResources.update_resources has cognitive complexity 83 (threshold 15). Drivers by points: if/else 24 (56 pts), loops 10 (20 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReliabilityEval._evaluate (cognitive 82) · ×1
  • ReliabilityEval._evaluate (cognitive 82) libs/agno/agno/eval/reliability.py:119 — ReliabilityEval._evaluate has cognitive complexity 82 (threshold 15). Drivers by points: if/else 25 (53 pts), loops 7 (13 pts), boolean chains 9, ternaries 3 (7 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIResponses._format_messages (cognitive 82) · ×1
  • OpenAIResponses._format_messages (cognitive 82) libs/agno/agno/models/openai/responses.py:663 — OpenAIResponses._format_messages has cognitive complexity 82 (threshold 15). Drivers by points: if/else 18 (56 pts), boolean chains 13, loops 4 (10 pts), ternaries 1 (3 pts) (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · connect._connect_one (cognitive 82) · ×1
  • connect._connect_one (cognitive 82) libs/agnoctl/agnoctl/commands/connect.py:711 — connect._connect_one has cognitive complexity 82 (threshold 15). Drivers by points: if/else 29 (62 pts), boolean chains 17, ternaries 2 (3 pts) (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PageCoordinator.sync (cognitive 81) · ×1
  • PageCoordinator.sync (cognitive 81) REDACTED:1404 — PageCoordinator.sync has cognitive complexity 81 (threshold 15). Drivers by points: if/else 24 (48 pts), error handling 6 (13 pts), boolean chains 12, loops 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChat._parse_provider_response_delta (cognitive 80) · ×1
  • OpenAIChat._parse_provider_response_delta (cognitive 80) libs/agno/agno/models/openai/chat.py:905 — OpenAIChat._parse_provider_response_delta has cognitive complexity 80 (threshold 15). Drivers by points: if/else 18 (59 pts), boolean chains 8, ternaries 1 (5 pts), error handling 1 (4 pts), loops 1 (4 pts) (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _messages.get_user_message (cognitive 79) · ×1
  • _messages.get_user_message (cognitive 79) libs/agno/agno/agent/_messages.py:1525 — _messages.get_user_message has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 19 (40 pts), if/else 14 (27 pts), error handling 3 (7 pts), boolean chains 5 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_messages.aget_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _messages.aget_user_message (cognitive 79) · ×1
  • _messages.aget_user_message (cognitive 79) libs/agno/agno/agent/_messages.py:1695 — _messages.aget_user_message has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 19 (40 pts), if/else 14 (27 pts), error handling 3 (7 pts), boolean chains 5 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_messages.get_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._run (cognitive 78) · ×1
  • _run._run (cognitive 78) libs/agno/agno/agent/_run.py:367 — _run._run has cognitive complexity 78 (threshold 15). Drivers by points: if/else 20 (47 pts), error handling 8 (20 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._apply_component_fields (cognitive 78) · ×1
  • StudioTools._apply_component_fields (cognitive 78) libs/agno/agno/tools/studio.py:2138 — StudioTools._apply_component_fields has cognitive complexity 78 (threshold 15). Drivers by points: if/else 36 (63 pts), boolean chains 7, loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMongoDb._get_collection (cognitive 77) · ×1
  • AsyncMongoDb._get_collection (cognitive 77) libs/agno/agno/db/mongo/async_mongo.py:381 — AsyncMongoDb._get_collection has cognitive complexity 77 (threshold 15). Drivers by points: if/else 33 (66 pts), boolean chains 11 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMySQLDb.upsert_sessions (cognitive 77) · ×1
  • AsyncMySQLDb.upsert_sessions (cognitive 77) libs/agno/agno/db/mysql/async_mysql.py:1323 — AsyncMySQLDb.upsert_sessions has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 7 (16 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MySQLDb.upsert_sessions (cognitive 77) · ×1
  • MySQLDb.upsert_sessions (cognitive 77) libs/agno/agno/db/mysql/mysql.py:1308 — MySQLDb.upsert_sessions has cognitive complexity 77 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 7 (16 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · diagnostics._check (cognitive 77) · ×1
  • diagnostics._check (cognitive 77) libs/agno/agno/os/diagnostics.py:168 — diagnostics._check has cognitive complexity 77 (threshold 15). Drivers by points: if/else 27 (52 pts), boolean chains 16, ternaries 2 (5 pts), loops 2 (4 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response._convert_response_to_structured_format (cognitive 77) · ×1
  • _response._convert_response_to_structured_format (cognitive 77) libs/agno/agno/team/_response.py:1671 — _response._convert_response_to_structured_format has cognitive complexity 77 (threshold 15). Drivers by points: if/else 23 (67 pts), error handling 2 (8 pts), boolean chains 1, ternaries 1 (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AgentSession.get_messages (cognitive 76) · ×1
  • AgentSession.get_messages (cognitive 76) libs/agno/agno/session/agent.py:141 — AgentSession.get_messages has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (56 pts), loops 5 (12 pts), boolean chains 8 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisEventStream.tail (cognitive 75) · ×1
  • RedisEventStream.tail (cognitive 75) libs/agno/agno/os/event_streams/redis.py:620 — RedisEventStream.tail has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (56 pts), loops 4 (7 pts), boolean chains 6, error handling 2 (5 pts), ternaries 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _CompanyScheduleExecutor._accept (cognitive 74) · ×1
  • _CompanyScheduleExecutor._accept (cognitive 74) libs/agno/agno/company/routines.py:772 — _CompanyScheduleExecutor._accept has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (38 pts), boolean chains 26, ternaries 4 (5 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ScheduleExecutor.execute (cognitive 74) · ×1
  • ScheduleExecutor.execute (cognitive 74) libs/agno/agno/scheduler/executor.py:82 — ScheduleExecutor.execute has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (47 pts), error handling 7 (16 pts), boolean chains 9, loops 1, ternaries 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._get_request_kwargs (cognitive 73) · ×1
  • GeminiInteractions._get_request_kwargs (cognitive 73) libs/agno/agno/models/google/gemini_interactions.py:452 — GeminiInteractions._get_request_kwargs has cognitive complexity 73 (threshold 15). Drivers by points: if/else 38 (61 pts), ternaries 3 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._get_user_message (cognitive 73) · ×1
  • _messages._get_user_message (cognitive 73) libs/agno/agno/team/_messages.py:1213 — _messages._get_user_message has cognitive complexity 73 (threshold 15). Drivers by points: if/else 16 (30 pts), ternaries 13 (30 pts), error handling 3 (7 pts), boolean chains 6 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_messages._aget_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _messages._aget_user_message (cognitive 73) · ×1
  • _messages._aget_user_message (cognitive 73) libs/agno/agno/team/_messages.py:1372 — _messages._aget_user_message has cognitive complexity 73 (threshold 15). Drivers by points: if/else 16 (30 pts), ternaries 13 (30 pts), error handling 3 (7 pts), boolean chains 6 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_messages._get_user_message) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._arun_tasks (cognitive 73) · ×1
  • _run._arun_tasks (cognitive 73) libs/agno/agno/team/_run.py:2117 — _run._arun_tasks has cognitive complexity 73 (threshold 15). Drivers by points: if/else 26 (50 pts), error handling 7 (11 pts), loops 4 (6 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.build_panels (cognitive 73) · ×1
  • agent.build_panels (cognitive 73) libs/agno/agno/utils/print_response/agent.py:794 — agent.build_panels has cognitive complexity 73 (threshold 15). Drivers by points: if/else 23 (47 pts), boolean chains 10, error handling 3 (9 pts), loops 3 (7 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DbInstance._create (cognitive 73) · ×1
  • DbInstance._create (cognitive 73) libs/agno_infra/agno/aws/resource/rds/db_instance.py:258 — DbInstance._create has cognitive complexity 73 (threshold 15). Drivers by points: if/else 62 (68 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · OpenAIResponses._parse_provider_response (cognitive 72) · ×1
  • OpenAIResponses._parse_provider_response (cognitive 72) libs/agno/agno/models/openai/responses.py:1336 — OpenAIResponses._parse_provider_response has cognitive complexity 72 (threshold 15). Drivers by points: if/else 17 (54 pts), loops 4 (13 pts), boolean chains 5 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · streamlit._load_session (cognitive 72) · ×1
  • streamlit._load_session (cognitive 72) libs/agno/agno/utils/streamlit.py:201 — streamlit._load_session has cognitive complexity 72 (threshold 15). Drivers by points: if/else 13 (51 pts), loops 2 (8 pts), ternaries 1 (6 pts), boolean chains 5, error handling 2 (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Knowledge._aload_url_page_groups (cognitive 71) · ×1
  • Knowledge._aload_url_page_groups (cognitive 71) libs/agno/agno/knowledge/knowledge.py:3382 — Knowledge._aload_url_page_groups has cognitive complexity 71 (threshold 15). Drivers by points: if/else 20 (43 pts), error handling 5 (14 pts), boolean chains 6, loops 3 (5 pts), ternaries 2 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._load_url_page_groups) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._load_url_page_groups (cognitive 71) · ×1
  • Knowledge._load_url_page_groups (cognitive 71) libs/agno/agno/knowledge/knowledge.py:3595 — Knowledge._load_url_page_groups has cognitive complexity 71 (threshold 15). Drivers by points: if/else 20 (43 pts), error handling 5 (14 pts), boolean chains 6, loops 3 (5 pts), ternaries 2 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._aload_url_page_groups) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RunOutput.to_dict (cognitive 71) · ×1
  • RunOutput.to_dict (cognitive 71) libs/agno/agno/run/agent.py:781 — RunOutput.to_dict has cognitive complexity 71 (threshold 15). Drivers by points: if/else 38 (50 pts), loops 6 (11 pts), ternaries 4 (8 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._arun (cognitive 71) · ×1
  • _run._arun (cognitive 71) libs/agno/agno/team/_run.py:3044 — _run._arun has cognitive complexity 71 (threshold 15). Drivers by points: if/else 18 (41 pts), error handling 8 (18 pts), loops 3 (7 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DbInstance._update (cognitive 71) · ×1
  • DbInstance._update (cognitive 71) libs/agno_infra/agno/aws/resource/rds/db_instance.py:536 — DbInstance._update has cognitive complexity 71 (threshold 15). Drivers by points: if/else 57 (63 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _run.continue_run_dispatch (cognitive 70) · ×1
  • _run.continue_run_dispatch (cognitive 70) libs/agno/agno/agent/_run.py:3285 — _run.continue_run_dispatch has cognitive complexity 70 (threshold 15). Drivers by points: if/else 26 (40 pts), boolean chains 16, ternaries 7 (10 pts), error handling 1 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageSource.fetch (cognitive 70) · ×1
  • PageSource.fetch (cognitive 70) libs/agno/agno/knowledge/page/_source.py:131 — PageSource.fetch has cognitive complexity 70 (threshold 15). Drivers by points: if/else 13 (44 pts), loops 4 (9 pts), error handling 2 (6 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowSession.get_messages_from_team_runs (cognitive 70) · ×1
  • WorkflowSession.get_messages_from_team_runs (cognitive 70) libs/agno/agno/session/workflow.py:335 — WorkflowSession.get_messages_from_team_runs has cognitive complexity 70 (threshold 15). Drivers by points: if/else 22 (52 pts), loops 5 (12 pts), boolean chains 6 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · streamlit.session_selector_widget (cognitive 70) · ×1
  • streamlit.session_selector_widget (cognitive 70) libs/agno/agno/utils/streamlit.py:57 — streamlit.session_selector_widget has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (51 pts), boolean chains 9, error handling 2 (6 pts), loops 2, ternaries 2 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SingleStoreDb.upsert_sessions (cognitive 69) · ×1
  • SingleStoreDb.upsert_sessions (cognitive 69) libs/agno/agno/db/singlestore/singlestore.py:1367 — SingleStoreDb.upsert_sessions has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (43 pts), loops 7 (16 pts), ternaries 3 (9 pts), error handling 1 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ValkeyDb.upsert_sessions (cognitive 69) · ×1
  • ValkeyDb.upsert_sessions (cognitive 69) libs/agno/agno/db/valkey/valkey.py:1102 — ValkeyDb.upsert_sessions has cognitive complexity 69 (threshold 15). Drivers by points: if/else 16 (30 pts), ternaries 8 (22 pts), boolean chains 9, loops 5 (7 pts), error handling 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._get_json_output_prompt (cognitive 69) · ×1
  • _messages._get_json_output_prompt (cognitive 69) libs/agno/agno/team/_messages.py:1654 — _messages._get_json_output_prompt has cognitive complexity 69 (threshold 15). Drivers by points: if/else 13 (51 pts), loops 3 (17 pts), boolean chains 1 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AgentOS.__init__ (cognitive 68) · ×1
  • AgentOS.__init__ (cognitive 68) libs/agno/agno/os/app.py:314 — AgentOS.__init__ has cognitive complexity 68 (threshold 15). Drivers by points: if/else 30 (37 pts), boolean chains 17, ternaries 9 (14 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · router.handle_workflow_continue_via_websocket (cognitive 68) · ×1
  • router.handle_workflow_continue_via_websocket (cognitive 68) libs/agno/agno/os/routers/workflows/router.py:842 — router.handle_workflow_continue_via_websocket has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 18, error handling 7 (9 pts), ternaries 3 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · json_schema.get_json_schema_for_arg (cognitive 68) · ×1
  • json_schema.get_json_schema_for_arg (cognitive 68) libs/agno/agno/utils/json_schema.py:99 — json_schema.get_json_schema_for_arg has cognitive complexity 68 (threshold 15). Drivers by points: if/else 19 (42 pts), ternaries 4 (12 pts), boolean chains 5, loops 2 (5 pts), error handling 1 (4 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · message.get_text_from_message (cognitive 68) · ×1
  • message.get_text_from_message (cognitive 68) libs/agno/agno/utils/message.py:303 — message.get_text_from_message has cognitive complexity 68 (threshold 15). Drivers by points: if/else 18 (53 pts), loops 3 (9 pts), boolean chains 6 (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DockerImage.build_image (cognitive 68) · ×1
  • DockerImage.build_image (cognitive 68) libs/agno_infra/agno/docker/resource/image.py:169 — DockerImage.build_image has cognitive complexity 68 (threshold 15). Drivers by points: if/else 21 (46 pts), loops 5 (11 pts), boolean chains 7, error handling 4 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb._create_table (cognitive 67) · ×1
  • SqliteDb._create_table (cognitive 67) REDACTED:379 — SqliteDb._create_table has cognitive complexity 67 (threshold 15). Drivers by points: if/else 24 (45 pts), loops 8 (9 pts), boolean chains 5, ternaries 5, error handling 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._populate_registry (cognitive 67) · ×1
  • AgentOS._populate_registry (cognitive 67) libs/agno/agno/os/app.py:1308 — AgentOS._populate_registry has cognitive complexity 67 (threshold 15). Drivers by points: if/else 25 (54 pts), loops 3 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.handle_workflow_via_websocket (cognitive 67) · ×1
  • router.handle_workflow_via_websocket (cognitive 67) libs/agno/agno/os/routers/workflows/router.py:269 — router.handle_workflow_via_websocket has cognitive complexity 67 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 22, error handling 9 (13 pts), ternaries 4 (8 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowSession.get_messages_from_agent_runs (cognitive 67) · ×1
  • WorkflowSession.get_messages_from_agent_runs (cognitive 67) libs/agno/agno/session/workflow.py:230 — WorkflowSession.get_messages_from_agent_runs has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (49 pts), loops 5 (12 pts), boolean chains 6 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DbCluster._create (cognitive 67) · ×1
  • DbCluster._create (cognitive 67) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:336 — DbCluster._create has cognitive complexity 67 (threshold 15). Drivers by points: if/else 56 (62 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MongoDb._get_collection (cognitive 66) · ×1
  • MongoDb._get_collection (cognitive 66) libs/agno/agno/db/mongo/mongo.py:185 — MongoDb._get_collection has cognitive complexity 66 (threshold 15). Drivers by points: if/else 33 (66 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb._create_table (cognitive 66) · ×1
  • PostgresDb._create_table (cognitive 66) libs/agno/agno/db/postgres/postgres.py:382 — PostgresDb._create_table has cognitive complexity 66 (threshold 15). Drivers by points: if/else 27 (49 pts), loops 8 (9 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCoordinator.search (cognitive 66) · ×1
  • PageCoordinator.search (cognitive 66) REDACTED:1145 — PageCoordinator.search has cognitive complexity 66 (threshold 15). Drivers by points: if/else 16 (32 pts), error handling 6 (12 pts), boolean chains 11, loops 6 (8 pts), ternaries 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · disconnect._disconnect (cognitive 66) · ×1
  • disconnect._disconnect (cognitive 66) libs/agnoctl/agnoctl/commands/disconnect.py:108 — disconnect._disconnect has cognitive complexity 66 (threshold 15). Drivers by points: if/else 16 (32 pts), error handling 5 (12 pts), ternaries 5 (9 pts), boolean chains 7, loops 4 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages.get_run_messages (cognitive 64) · ×1
  • _messages.get_run_messages (cognitive 64) libs/agno/agno/agent/_messages.py:1879 — _messages.get_run_messages has cognitive complexity 64 (threshold 15). Drivers by points: if/else 19 (37 pts), error handling 4 (12 pts), boolean chains 9, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_messages.aget_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _messages.aget_run_messages (cognitive 64) · ×1
  • _messages.aget_run_messages (cognitive 64) libs/agno/agno/agent/_messages.py:2094 — _messages.aget_run_messages has cognitive complexity 64 (threshold 15). Drivers by points: if/else 19 (37 pts), error handling 4 (12 pts), boolean chains 9, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_messages.get_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · BaseExternalAgent._arun_stream (cognitive 64) · ×1
  • BaseExternalAgent._arun_stream (cognitive 64) libs/agno/agno/agents/base.py:1869 — BaseExternalAgent._arun_stream has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 14, error handling 4 (6 pts), ternaries 6, loops 3 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMongoDb.upsert_sessions (cognitive 64) · ×1
  • AsyncMongoDb.upsert_sessions (cognitive 64) libs/agno/agno/db/mongo/async_mongo.py:1260 — AsyncMongoDb.upsert_sessions has cognitive complexity 64 (threshold 15). Drivers by points: if/else 21 (48 pts), ternaries 3 (8 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MongoDb.upsert_sessions (cognitive 64) · ×1
  • MongoDb.upsert_sessions (cognitive 64) libs/agno/agno/db/mongo/mongo.py:1069 — MongoDb.upsert_sessions has cognitive complexity 64 (threshold 15). Drivers by points: if/else 21 (48 pts), ternaries 3 (8 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LiteLLM._format_messages (cognitive 64) · ×1
  • LiteLLM._format_messages (cognitive 64) libs/agno/agno/models/litellm/chat.py:129 — LiteLLM._format_messages has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (42 pts), boolean chains 11, ternaries 2 (7 pts), loops 2 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · connect._report (cognitive 64) · ×1
  • connect._report (cognitive 64) libs/agnoctl/agnoctl/commands/connect.py:868 — connect._report has cognitive complexity 64 (threshold 15). Drivers by points: if/else 22 (33 pts), ternaries 7 (16 pts), loops 5 (9 pts), boolean chains 6 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamResponse.from_team (cognitive 63) · ×1
  • TeamResponse.from_team (cognitive 63) libs/agno/agno/os/routers/teams/schema.py:73 — TeamResponse.from_team has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (26 pts), ternaries 21 (22 pts), boolean chains 12, error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkflowRunOutput.to_dict (cognitive 63) · ×1
  • WorkflowRunOutput.to_dict (cognitive 63) libs/agno/agno/run/workflow.py:886 — WorkflowRunOutput.to_dict has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 14 (30 pts), if/else 24 (29 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _media.stage_media (cognitive 62) · ×1
  • _media.stage_media (cognitive 62) libs/agno/agno/agents/_media.py:152 — _media.stage_media has cognitive complexity 62 (threshold 15). Drivers by points: if/else 10 (30 pts), error handling 4 (14 pts), loops 4 (9 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrations.rekey_user_entity_learnings (cognitive 62) · ×1
  • migrations.rekey_user_entity_learnings (cognitive 62) libs/agno/agno/learn/migrations.py:285 — migrations.rekey_user_entity_learnings has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (36 pts), ternaries 4 (14 pts), boolean chains 8, error handling 1 (2 pts), loops 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (migrations.arekey_user_entity_learnings) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · migrations.arekey_user_entity_learnings (cognitive 62) · ×1
  • migrations.arekey_user_entity_learnings (cognitive 62) libs/agno/agno/learn/migrations.py:454 — migrations.arekey_user_entity_learnings has cognitive complexity 62 (threshold 15). Drivers by points: if/else 16 (36 pts), ternaries 4 (14 pts), boolean chains 8, error handling 1 (2 pts), loops 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (migrations.rekey_user_entity_learnings) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · WebsiteReader.crawl (cognitive 61) · ×1
  • WebsiteReader.crawl (cognitive 61) libs/agno/agno/knowledge/reader/website_reader.py:155 — WebsiteReader.crawl has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 8, error handling 3 (6 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAgent._translate_notification (cognitive 60) · ×1
  • CodexAgent._translate_notification (cognitive 60) libs/agno/agno/agents/codex/agent.py:974 — CodexAgent._translate_notification has cognitive complexity 60 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 18 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · RunInput.to_dict (cognitive 60) · ×1
  • RunInput.to_dict (cognitive 60) libs/agno/agno/run/agent.py:77 — RunInput.to_dict has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (33 pts), ternaries 4 (24 pts), loops 1 (3 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TeamRunInput.to_dict (cognitive 60) · ×1
  • TeamRunInput.to_dict (cognitive 60) libs/agno/agno/run/team.py:63 — TeamRunInput.to_dict has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (33 pts), ternaries 4 (24 pts), loops 1 (3 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DynamoDb.get_sessions (cognitive 58) · ×1
  • DynamoDb.get_sessions (cognitive 58) libs/agno/agno/db/dynamo/dynamo.py:746 — DynamoDb.get_sessions has cognitive complexity 58 (threshold 15). Drivers by points: if/else 29 (41 pts), loops 4 (7 pts), boolean chains 5, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model._populate_stream_data (cognitive 58) · ×1
  • Model._populate_stream_data (cognitive 58) REDACTED:1930 — Model._populate_stream_data has cognitive complexity 58 (threshold 15). Drivers by points: if/else 31 (51 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model.run_function_calls (cognitive 58) · ×1
  • Model.run_function_calls (cognitive 58) REDACTED:2416 — Model.run_function_calls has cognitive complexity 58 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 5 (16 pts), boolean chains 5 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._auto_discover_databases (cognitive 58) · ×1
  • AgentOS._auto_discover_databases (cognitive 58) libs/agno/agno/os/app.py:2715 — AgentOS._auto_discover_databases has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (40 pts), boolean chains 7, ternaries 2 (6 pts), loops 5 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · approval._agroup_tools_by_approval (cognitive 58) · ×1
  • approval._agroup_tools_by_approval (cognitive 58) libs/agno/agno/run/approval.py:634 — approval._agroup_tools_by_approval has cognitive complexity 58 (threshold 15). Drivers by points: if/else 11 (32 pts), ternaries 4 (14 pts), loops 2 (5 pts), error handling 1 (4 pts), boolean chains 3 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · function._derive_entrypoint_schema (cognitive 58) · ×1
  • function._derive_entrypoint_schema (cognitive 58) libs/agno/agno/tools/function.py:586 — function._derive_entrypoint_schema has cognitive complexity 58 (threshold 15). Drivers by points: if/else 27 (39 pts), boolean chains 13, loops 2 (4 pts), error handling 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.execute_stream (cognitive 58) · ×1
  • Router.execute_stream (cognitive 58) libs/agno/agno/workflow/router.py:762 — Router.execute_stream has cognitive complexity 58 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 18, error handling 3 (6 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Router.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Router.aexecute_stream (cognitive 58) · ×1
  • Router.aexecute_stream (cognitive 58) libs/agno/agno/workflow/router.py:1099 — Router.aexecute_stream has cognitive complexity 58 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 18, error handling 3 (6 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Router.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Workflow._deep_copy_single_step (cognitive 58) · ×1
  • Workflow._deep_copy_single_step (cognitive 58) libs/agno/agno/workflow/workflow.py:11791 — Workflow._deep_copy_single_step has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 11 (25 pts), error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DbCluster._update (cognitive 58) · ×1
  • DbCluster._update (cognitive 58) libs/agno_infra/agno/aws/resource/rds/db_cluster.py:621 — DbCluster._update has cognitive complexity 58 (threshold 15). Drivers by points: if/else 46 (52 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · OpenAIResponses._parse_provider_response_delta (cognitive 57) · ×1
  • OpenAIResponses._parse_provider_response_delta (cognitive 57) libs/agno/agno/models/openai/responses.py:1432 — OpenAIResponses._parse_provider_response_delta has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (48 pts), boolean chains 6, loops 1 (3 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._resolve_member_run_output_for_continue (cognitive 57) · ×1
  • _run._resolve_member_run_output_for_continue (cognitive 57) libs/agno/agno/team/_run.py:6188 — _run._resolve_member_run_output_for_continue has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (36 pts), boolean chains 10, loops 3 (9 pts), ternaries 2 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SingleStoreDb._create_table (cognitive 56) · ×1
  • SingleStoreDb._create_table (cognitive 56) libs/agno/agno/db/singlestore/singlestore.py:235 — SingleStoreDb._create_table has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (37 pts), loops 7 (10 pts), boolean chains 5, error handling 2 (3 pts), ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge._aload_from_url (cognitive 56) · ×1
  • Knowledge._aload_from_url (cognitive 56) libs/agno/agno/knowledge/knowledge.py:2544 — Knowledge._aload_from_url has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 17, ternaries 5 (11 pts), error handling 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._load_from_url) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._load_from_url (cognitive 56) · ×1
  • Knowledge._load_from_url (cognitive 56) libs/agno/agno/knowledge/knowledge.py:2733 — Knowledge._load_from_url has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 17, ternaries 5 (11 pts), error handling 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._aload_from_url) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · mdx._render (cognitive 56) · ×1
  • mdx._render (cognitive 56) libs/agno/agno/knowledge/reader/utils/mdx.py:101 — mdx._render has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (26 pts), ternaries 12 (24 pts), boolean chains 6 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._run_tasks (cognitive 56) · ×1
  • _run._run_tasks (cognitive 56) libs/agno/agno/team/_run.py:236 — _run._run_tasks has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (35 pts), error handling 8 (13 pts), boolean chains 4, loops 2, ternaries 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · infra_cli.up (cognitive 56) · ×1
  • infra_cli.up (cognitive 56) libs/agno_infra/agno/cli/infra_cli.py:81 — infra_cli.up has cognitive complexity 56 (threshold 15). Drivers by points: if/else 26 (41 pts), boolean chains 9, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (infra_cli.down) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · infra_cli.down (cognitive 56) · ×1
  • infra_cli.down (cognitive 56) libs/agno_infra/agno/cli/infra_cli.py:279 — infra_cli.down has cognitive complexity 56 (threshold 15). Drivers by points: if/else 26 (41 pts), boolean chains 9, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (infra_cli.up) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · A2AClient._parse_stream_event (cognitive 55) · ×1
  • A2AClient._parse_stream_event (cognitive 55) libs/agno/agno/client/a2a/client.py:231 — A2AClient._parse_stream_event has cognitive complexity 55 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 7 (18 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bootstrap.arehydrate_product (cognitive 55) · ×1
  • bootstrap.arehydrate_product (cognitive 55) libs/agno/agno/company/bootstrap.py:15 — bootstrap.arehydrate_product has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 9, error handling 3 (8 pts), loops 3, ternaries 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParallelPageFetcher.fetch_many (cognitive 55) · ×1
  • ParallelPageFetcher.fetch_many (cognitive 55) libs/agno/agno/knowledge/reader/page_fetcher.py:349 — ParallelPageFetcher.fetch_many has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 7 (17 pts), error handling 2 (8 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamRunOutput.to_dict (cognitive 55) · ×1
  • TeamRunOutput.to_dict (cognitive 55) libs/agno/agno/run/team.py:871 — TeamRunOutput.to_dict has cognitive complexity 55 (threshold 15). Drivers by points: if/else 30 (34 pts), ternaries 8 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _run._run (cognitive 55) · ×1
  • _run._run (cognitive 55) libs/agno/agno/team/_run.py:1082 — _run._run has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (29 pts), error handling 8 (20 pts), boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parallel.execute_stream (cognitive 55) · ×1
  • Parallel.execute_stream (cognitive 55) libs/agno/agno/workflow/parallel.py:457 — Parallel.execute_stream has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 14, error handling 5 (10 pts), loops 5 (7 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · suite._run_case_body (cognitive 54) · ×1
  • suite._run_case_body (cognitive 54) libs/agno/agno/eval/suite.py:353 — suite._run_case_body has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (29 pts), error handling 5 (10 pts), boolean chains 9, ternaries 3 (5 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge._aprocess_lightrag_content (cognitive 54) · ×1
  • Knowledge._aprocess_lightrag_content (cognitive 54) libs/agno/agno/knowledge/knowledge.py:4931 — Knowledge._aprocess_lightrag_content has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 9, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._process_lightrag_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._process_lightrag_content (cognitive 54) · ×1
  • Knowledge._process_lightrag_content (cognitive 54) libs/agno/agno/knowledge/knowledge.py:5103 — Knowledge._process_lightrag_content has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 9, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._aprocess_lightrag_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · EntityMemoryStore.print (cognitive 54) · ×1
  • EntityMemoryStore.print (cognitive 54) libs/agno/agno/learn/stores/entity_memory.py:3661 — EntityMemoryStore.print has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 4 (12 pts), ternaries 2 (7 pts), boolean chains 2 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · metrics.merge_background_metrics (cognitive 54) · ×1
  • metrics.merge_background_metrics (cognitive 54) libs/agno/agno/metrics.py:770 — metrics.merge_background_metrics has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 5 (16 pts), boolean chains 3 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentResponse.from_agent (cognitive 54) · ×1
  • AgentResponse.from_agent (cognitive 54) libs/agno/agno/os/routers/agents/schema.py:73 — AgentResponse.from_agent has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 19 (20 pts), boolean chains 9, error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · router.handle_workflow_subscription (cognitive 54) · ×1
  • router.handle_workflow_subscription (cognitive 54) libs/agno/agno/os/routers/workflows/router.py:599 — router.handle_workflow_subscription has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 3 (15 pts), loops 3 (9 pts), error handling 5 (8 pts), boolean chains 3 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PubmedTools.parse_details (cognitive 54) · ×1
  • PubmedTools.parse_details (cognitive 54) libs/agno/agno/tools/pubmed.py:53 — PubmedTools.parse_details has cognitive complexity 54 (threshold 15). Drivers by points: if/else 10 (24 pts), ternaries 9 (18 pts), loops 5 (10 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsApp.build_resources (cognitive 54) · ×1
  • AwsApp.build_resources (cognitive 54) libs/agno_infra/agno/aws/app/base.py:614 — AwsApp.build_resources has cognitive complexity 54 (threshold 15). Drivers by points: if/else 29 (44 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.delete_component (cognitive 53) · ×1
  • PostgresDb.delete_component (cognitive 53) libs/agno/agno/db/postgres/postgres.py:4734 — PostgresDb.delete_component has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (45 pts), boolean chains 7, error handling 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.delete_component (cognitive 53) · ×1
  • SqliteDb.delete_component (cognitive 53) REDACTED:4576 — SqliteDb.delete_component has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (45 pts), boolean chains 7, error handling 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · approval._group_tools_by_approval (cognitive 53) · ×1
  • approval._group_tools_by_approval (cognitive 53) libs/agno/agno/run/approval.py:570 — approval._group_tools_by_approval has cognitive complexity 53 (threshold 15). Drivers by points: if/else 11 (32 pts), ternaries 3 (10 pts), loops 2 (5 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Loop.execute (cognitive 53) · ×1
  • Loop.execute (cognitive 53) libs/agno/agno/workflow/loop.py:422 — Loop.execute has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 5 (12 pts), ternaries 4 (6 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Loop.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Loop.aexecute (cognitive 53) · ×1
  • Loop.aexecute (cognitive 53) libs/agno/agno/workflow/loop.py:827 — Loop.aexecute has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 5 (12 pts), ternaries 4 (6 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Loop.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · LiteLLM._parse_provider_response_delta (cognitive 52) · ×1
  • LiteLLM._parse_provider_response_delta (cognitive 52) libs/agno/agno/models/litellm/chat.py:386 — LiteLLM._parse_provider_response_delta has cognitive complexity 52 (threshold 15). Drivers by points: if/else 10 (35 pts), boolean chains 8, ternaries 1 (5 pts), loops 1 (4 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · utils.collect_mcp_tools_from_workflow_step (cognitive 52) · ×1
  • utils.collect_mcp_tools_from_workflow_step (cognitive 52) libs/agno/agno/os/utils.py:2380 — utils.collect_mcp_tools_from_workflow_step has cognitive complexity 52 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 4 (13 pts), boolean chains 5 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Steps.execute_stream (cognitive 52) · ×1
  • Steps.execute_stream (cognitive 52) libs/agno/agno/workflow/steps.py:375 — Steps.execute_stream has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 13, ternaries 3 (5 pts), error handling 3, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Steps.aexecute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Steps.aexecute_stream (cognitive 52) · ×1
  • Steps.aexecute_stream (cognitive 52) libs/agno/agno/workflow/steps.py:680 — Steps.aexecute_stream has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 13, ternaries 3 (5 pts), error handling 3, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Steps.execute_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · routines._routine_failure (cognitive 51) · ×1
  • routines._routine_failure (cognitive 51) libs/agno/agno/company/routines.py:71 — routines._routine_failure has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 10, loops 3 (6 pts), error handling 1 (5 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._initialize_agents (cognitive 51) · ×1
  • AgentOS._initialize_agents (cognitive 51) libs/agno/agno/os/app.py:1197 — AgentOS._initialize_agents has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (36 pts), boolean chains 9, loops 3 (5 pts), ternaries 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · input.extract_media (cognitive 51) · ×1
  • input.extract_media (cognitive 51) REDACTED:33 — input.extract_media has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (31 pts), boolean chains 12, ternaries 1 (5 pts), loops 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._backfill_approval_to_requirements (cognitive 51) · ×1
  • _run._backfill_approval_to_requirements (cognitive 51) libs/agno/agno/team/_run.py:5875 — _run._backfill_approval_to_requirements has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 9, loops 6 (9 pts), ternaries 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KernelSession._execute_locked (cognitive 51) · ×1
  • KernelSession._execute_locked (cognitive 51) libs/agno/agno/tools/code/kernel.py:612 — KernelSession._execute_locked has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (31 pts), error handling 2 (7 pts), ternaries 4 (7 pts), boolean chains 5, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._arun_workflow_agent (cognitive 51) · ×1
  • Workflow._arun_workflow_agent (cognitive 51) libs/agno/agno/workflow/workflow.py:6368 — Workflow._arun_workflow_agent has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (32 pts), ternaries 2 (8 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · InfraConfig.get_resources (cognitive 51) · ×1
  • InfraConfig.get_resources (cognitive 51) libs/agno_infra/agno/infra/config.py:104 — InfraConfig.get_resources has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 6 (12 pts), error handling 1 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools.aget_tools (cognitive 50) · ×1
  • _tools.aget_tools (cognitive 50) libs/agno/agno/agent/_tools.py:326 — _tools.aget_tools has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 7, error handling 1 (5 pts), ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _CompanyScheduleExecutor.execute (cognitive 50) · ×1
  • _CompanyScheduleExecutor.execute (cognitive 50) libs/agno/agno/company/routines.py:510 — _CompanyScheduleExecutor.execute has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 12, ternaries 6 (11 pts), error handling 5 (9 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.upsert_component (cognitive 50) · ×1
  • SqliteDb.upsert_component (cognitive 50) REDACTED:4412 — SqliteDb.upsert_component has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (42 pts), ternaries 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Knowledge._aload_dir_as_folder (cognitive 50) · ×1
  • Knowledge._aload_dir_as_folder (cognitive 50) libs/agno/agno/knowledge/knowledge.py:2970 — Knowledge._aload_dir_as_folder has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (27 pts), error handling 3 (9 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._load_dir_as_folder) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._load_dir_as_folder (cognitive 50) · ×1
  • Knowledge._load_dir_as_folder (cognitive 50) libs/agno/agno/knowledge/knowledge.py:3093 — Knowledge._load_dir_as_folder has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (27 pts), error handling 3 (9 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._aload_dir_as_folder) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._aload_from_content (cognitive 50) · ×1
  • Knowledge._aload_from_content (cognitive 50) libs/agno/agno/knowledge/knowledge.py:3786 — Knowledge._aload_from_content has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (42 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._load_from_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._load_from_content (cognitive 50) · ×1
  • Knowledge._load_from_content (cognitive 50) libs/agno/agno/knowledge/knowledge.py:3898 — Knowledge._load_from_content has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (42 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge._aload_from_content) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RunMetrics.__add__ (cognitive 50) · ×1
  • RunMetrics.__add__ (cognitive 50) libs/agno/agno/metrics.py:336 — RunMetrics.__add__ has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 4 (14 pts), boolean chains 6 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sandbox._sandbox_start_gate (cognitive 50) · ×1
  • sandbox._sandbox_start_gate (cognitive 50) libs/agno/agno/os/routers/company/sandbox.py:48 — sandbox._sandbox_start_gate has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 8, error handling 2 (5 pts), loops 4 (5 pts), ternaries 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response._ahandle_model_response_stream (cognitive 50) · ×1
  • _response._ahandle_model_response_stream (cognitive 50) libs/agno/agno/team/_response.py:1148 — _response._ahandle_model_response_stream has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.scrub_media_from_run_output (cognitive 50) · ×1
  • agent.scrub_media_from_run_output (cognitive 50) libs/agno/agno/utils/agent.py:454 — agent.scrub_media_from_run_output has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 12, loops 4 (8 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SitemapReader._discover (cognitive 49) · ×1
  • SitemapReader._discover (cognitive 49) REDACTED:171 — SitemapReader._discover has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), ternaries 5 (10 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebsiteReader.async_crawl (cognitive 49) · ×1
  • WebsiteReader.async_crawl (cognitive 49) libs/agno/agno/knowledge/reader/website_reader.py:290 — WebsiteReader.async_crawl has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 7, error handling 3 (6 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueWorker._persist_run_error_inner (cognitive 49) · ×1
  • QueueWorker._persist_run_error_inner (cognitive 49) libs/agno/agno/os/job_queue.py:1553 — QueueWorker._persist_run_error_inner has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (27 pts), ternaries 5 (13 pts), boolean chains 9 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteDb.from_config (cognitive 49) · ×1
  • RemoteDb.from_config (cognitive 49) libs/agno/agno/remote/base.py:66 — RemoteDb.from_config has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 14, ternaries 7 (14 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · approval._sync_requirements_after_approval (cognitive 49) · ×1
  • approval._sync_requirements_after_approval (cognitive 49) libs/agno/agno/run/approval.py:693 — approval._sync_requirements_after_approval has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (35 pts), boolean chains 8, loops 2 (6 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · UpstashVectorDb.async_upsert (cognitive 49) · ×1
  • UpstashVectorDb.async_upsert (cognitive 49) REDACTED:623 — UpstashVectorDb.async_upsert has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (30 pts), ternaries 3 (7 pts), error handling 2 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InfraApp.add_app_properties_to_resources (cognitive 49) · ×1
  • InfraApp.add_app_properties_to_resources (cognitive 49) libs/agno_infra/agno/base/app.py:115 — InfraApp.add_app_properties_to_resources has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 14, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge.aremove_content_by_id (cognitive 48) · ×1
  • Knowledge.aremove_content_by_id (cognitive 48) libs/agno/agno/knowledge/knowledge.py:1577 — Knowledge.aremove_content_by_id has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 9, ternaries 3, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemory.get_context_text (cognitive 48) · ×1
  • EntityMemory.get_context_text (cognitive 48) libs/agno/agno/learn/schemas.py:815 — EntityMemory.get_context_text has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 5 (15 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPIdentityBridgeMiddleware.__call__ (cognitive 48) · ×1
  • MCPIdentityBridgeMiddleware.__call__ (cognitive 48) libs/agno/agno/os/mcp_auth.py:207 — MCPIdentityBridgeMiddleware.__call__ has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (29 pts), ternaries 2 (10 pts), boolean chains 5, error handling 1 (4 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _response._handle_model_response_stream (cognitive 48) · ×1
  • _response._handle_model_response_stream (cognitive 48) libs/agno/agno/team/_response.py:987 — _response._handle_model_response_stream has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GmailTools.__init__ (cognitive 48) · ×1
  • GmailTools.__init__ (cognitive 48) libs/agno/agno/tools/google/gmail.py:142 — GmailTools.__init__ has cognitive complexity 48 (threshold 15). Drivers by points: if/else 42 (46 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · agent.build_panels_stream (cognitive 48) · ×1
  • agent.build_panels_stream (cognitive 48) libs/agno/agno/utils/print_response/agent.py:442 — agent.build_panels_stream has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChromaDb._hybrid_search (cognitive 48) · ×1
  • ChromaDb._hybrid_search (cognitive 48) REDACTED:1021 — ChromaDb._hybrid_search has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 6 (13 pts), boolean chains 6, error handling 2 (5 pts), loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChromaDb._build_search_results (cognitive 48) · ×1
  • ChromaDb._build_search_results (cognitive 48) REDACTED:1213 — ChromaDb._build_search_results has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 7 (14 pts), error handling 4 (9 pts), boolean chains 7, loops 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qdrant.async_insert (cognitive 48) · ×1
  • Qdrant.async_insert (cognitive 48) REDACTED:450 — Qdrant.async_insert has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (11 pts), error handling 2 (7 pts), ternaries 1 (5 pts), boolean chains 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._arun_workflow_agent_stream (cognitive 48) · ×1
  • Workflow._arun_workflow_agent_stream (cognitive 48) libs/agno/agno/workflow/workflow.py:6174 — Workflow._arun_workflow_agent_stream has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 6 (15 pts), boolean chains 5, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EcsService._create (cognitive 48) · ×1
  • EcsService._create (cognitive 48) libs/agno_infra/agno/aws/resource/ecs/service.py:121 — EcsService._create has cognitive complexity 48 (threshold 15). Drivers by points: if/else 29 (38 pts), loops 2 (6 pts), boolean chains 3, error handling 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _response.ahandle_model_response_stream (cognitive 47) · ×1
  • _response.ahandle_model_response_stream (cognitive 47) libs/agno/agno/agent/_response.py:1193 — _response.ahandle_model_response_stream has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools.run_tool (cognitive 47) · ×1
  • _tools.run_tool (cognitive 47) libs/agno/agno/agent/_tools.py:859 — _tools.run_tool has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (45 pts), boolean chains 1, loops 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_tools.arun_tool) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _tools.arun_tool (cognitive 47) · ×1
  • _tools.arun_tool (cognitive 47) libs/agno/agno/agent/_tools.py:974 — _tools.arun_tool has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (45 pts), boolean chains 1, loops 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (_tools.run_tool) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GcsJsonDb.get_sessions (cognitive 47) · ×1
  • GcsJsonDb.get_sessions (cognitive 47) libs/agno/agno/db/gcs_json/gcs_json_db.py:544 — GcsJsonDb.get_sessions has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 10, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.get_sessions (cognitive 47) · ×1
  • InMemoryDb.get_sessions (cognitive 47) libs/agno/agno/db/in_memory/in_memory_db.py:223 — InMemoryDb.get_sessions has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 10, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_sessions (cognitive 47) · ×1
  • JsonDb.get_sessions (cognitive 47) libs/agno/agno/db/json/json_db.py:593 — JsonDb.get_sessions has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 10, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemini.get_request_params (cognitive 47) · ×1
  • Gemini.get_request_params (cognitive 47) libs/agno/agno/models/google/gemini.py:287 — Gemini.get_request_params has cognitive complexity 47 (threshold 15). Drivers by points: if/else 31 (40 pts), boolean chains 7 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Gemini._format_file_for_message (cognitive 47) · ×1
  • Gemini._format_file_for_message (cognitive 47) libs/agno/agno/models/google/gemini.py:1140 — Gemini._format_file_for_message has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 10, error handling 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ChromaDb._build_get_results (cognitive 47) · ×1
  • ChromaDb._build_get_results (cognitive 47) REDACTED:1311 — ChromaDb._build_get_results has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 7 (13 pts), error handling 4 (8 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._run_workflow_agent (cognitive 47) · ×1
  • Workflow._run_workflow_agent (cognitive 47) libs/agno/agno/workflow/workflow.py:5949 — Workflow._run_workflow_agent has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (29 pts), ternaries 2 (8 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _CompanyScheduleExecutor._tick (cognitive 46) · ×1
  • _CompanyScheduleExecutor._tick (cognitive 46) libs/agno/agno/company/routines.py:640 — _CompanyScheduleExecutor._tick has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 7, loops 4 (7 pts), ternaries 2 (6 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownChunking._split_large_section (cognitive 46) · ×1
  • MarkdownChunking._split_large_section (cognitive 46) libs/agno/agno/knowledge/chunking/markdown.py:40 — MarkdownChunking._split_large_section has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 6 (16 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ollama._format_message (cognitive 46) · ×1
  • Ollama._format_message (cognitive 46) libs/agno/agno/models/ollama/chat.py:150 — Ollama._format_message has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIResponses._format_tool_params (cognitive 46) · ×1
  • OpenAIResponses._format_tool_params (cognitive 46) libs/agno/agno/models/openai/responses.py:599 — OpenAIResponses._format_tool_params has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 6 (17 pts), boolean chains 2, ternaries 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JWTValidator.validate_token (cognitive 46) · ×1
  • JWTValidator.validate_token (cognitive 46) libs/agno/agno/os/middleware/jwt.py:270 — JWTValidator.validate_token has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (30 pts), error handling 4 (10 pts), ternaries 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response._update_run_response (cognitive 46) · ×1
  • _response._update_run_response (cognitive 46) libs/agno/agno/team/_response.py:903 — _response._update_run_response has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 6, loops 2 (5 pts), ternaries 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 01_step_confirmation_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 01_step_confirmation_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:92 — 01_step_confirmation_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 02_step_user_input_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 02_step_user_input_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/02_step_user_input_and_tool_confirmation.py:103 — 02_step_user_input_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 03_condition_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 03_condition_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:121 — 03_condition_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 04_router_selection_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 04_router_selection_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/04_router_selection_and_tool_confirmation.py:128 — 04_router_selection_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 05_output_review_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 05_output_review_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:85 — 05_output_review_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 06_loop_confirmation_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 06_loop_confirmation_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:104 — 06_loop_confirmation_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 07_router_confirmation_and_tool_confirmation.resolve_executor_pause (cognitive 46) · ×1
  • 07_router_confirmation_and_tool_confirmation.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:122 — 07_router_confirmation_and_tool_confirmation.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 09_multi_step_mixed_hitl.resolve_executor_pause (cognitive 46) · ×1
  • 09_multi_step_mixed_hitl.resolve_executor_pause (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:212 — 09_multi_step_mixed_hitl.resolve_executor_pause has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 5 (16 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 03_step_user_input_streaming.run_workflow_streaming (cognitive 46) · ×1
  • 03_step_user_input_streaming.run_workflow_streaming (cognitive 46) cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:168 — 03_step_user_input_streaming.run_workflow_streaming has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (25 pts), ternaries 3 (12 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages.aget_relevant_docs_from_knowledge (cognitive 45) · ×1
  • _messages.aget_relevant_docs_from_knowledge (cognitive 45) libs/agno/agno/agent/_messages.py:2646 — _messages.aget_relevant_docs_from_knowledge has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (29 pts), ternaries 4 (7 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response.handle_model_response_stream (cognitive 45) · ×1
  • _response.handle_model_response_stream (cognitive 45) libs/agno/agno/agent/_response.py:1029 — _response.handle_model_response_stream has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ClaudeAgent._arun_adapter (cognitive 45) · ×1
  • ClaudeAgent._arun_adapter (cognitive 45) libs/agno/agno/agents/claude/agent.py:1065 — ClaudeAgent._arun_adapter has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 3 (7 pts), boolean chains 6, ternaries 1 (5 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.get_trace_stats (cognitive 45) · ×1
  • GcsJsonDb.get_trace_stats (cognitive 45) libs/agno/agno/db/gcs_json/gcs_json_db.py:1831 — GcsJsonDb.get_trace_stats has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 9, loops 2, error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncPostgresDb._create_table (cognitive 45) · ×1
  • AsyncPostgresDb._create_table (cognitive 45) libs/agno/agno/db/postgres/async_postgres.py:343 — AsyncPostgresDb._create_table has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 7 (8 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._isolate_attempt (cognitive 45) · ×1
  • runner._isolate_attempt (cognitive 45) libs/agno/agno/environments/runner.py:765 — runner._isolate_attempt has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 8, ternaries 3 (6 pts), loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge.remove_content_by_id (cognitive 45) · ×1
  • Knowledge.remove_content_by_id (cognitive 45) libs/agno/agno/knowledge/knowledge.py:1464 — Knowledge.remove_content_by_id has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 9, ternaries 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge._aload_from_path (cognitive 45) · ×1
  • Knowledge._aload_from_path (cognitive 45) libs/agno/agno/knowledge/knowledge.py:2394 — Knowledge._aload_from_path has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 4, error handling 1 (4 pts), ternaries 1 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (Knowledge._load_from_path) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._load_from_path (cognitive 45) · ×1
  • Knowledge._load_from_path (cognitive 45) libs/agno/agno/knowledge/knowledge.py:2469 — Knowledge._load_from_path has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 4, error handling 1 (4 pts), ternaries 1 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (Knowledge._aload_from_path) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionMetrics.__add__ (cognitive 45) · ×1
  • SessionMetrics.__add__ (cognitive 45) libs/agno/agno/metrics.py:558 — SessionMetrics.__add__ has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4 (14 pts), boolean chains 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolBridge._build (cognitive 45) · ×1
  • ToolBridge._build (cognitive 45) libs/agno/agno/tools/code/bridge.py:468 — ToolBridge._build has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (33 pts), error handling 2 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FunctionCall._aexecute (cognitive 45) · ×1
  • FunctionCall._aexecute (cognitive 45) libs/agno/agno/tools/function.py:2889 — FunctionCall._aexecute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 9, ternaries 3 (7 pts), error handling 4 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 02_error_retry_skip_streaming.main (cognitive 45) · ×1
  • 02_error_retry_skip_streaming.main (cognitive 45) cookbook/04_workflows/08_human_in_the_loop/error/02_error_retry_skip_streaming.py:113 — 02_error_retry_skip_streaming.main has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 6 (20 pts), if/else 6 (15 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MigrationManager.up (cognitive 44) · ×1
  • MigrationManager.up (cognitive 44) libs/agno/agno/db/migrations/manager.py:34 — MigrationManager.up has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (35 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v1_to_v2.safe_get_runs_from_memory (cognitive 44) · ×1
  • v1_to_v2.safe_get_runs_from_memory (cognitive 44) REDACTED:134 — v1_to_v2.safe_get_runs_from_memory has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 2 (5 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.upsert_component (cognitive 44) · ×1
  • PostgresDb.upsert_component (cognitive 44) libs/agno/agno/db/postgres/postgres.py:4571 — PostgresDb.upsert_component has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (42 pts), error handling 1, ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AsyncSqliteDb._create_table (cognitive 44) · ×1
  • AsyncSqliteDb._create_table (cognitive 44) REDACTED:328 — AsyncSqliteDb._create_table has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 7 (8 pts), ternaries 4, boolean chains 3, error handling 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils._eval_filter_expr (cognitive 44) · ×1
  • utils._eval_filter_expr (cognitive 44) libs/agno/agno/db/valkey/utils.py:246 — utils._eval_filter_expr has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 3 (6 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.upsert_memories (cognitive 44) · ×1
  • ValkeyDb.upsert_memories (cognitive 44) libs/agno/agno/db/valkey/valkey.py:1604 — ValkeyDb.upsert_memories has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 5 (11 pts), loops 7 (9 pts), boolean chains 3, error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChat._parse_provider_response (cognitive 44) · ×1
  • OpenAIChat._parse_provider_response (cognitive 44) libs/agno/agno/models/openai/chat.py:804 — OpenAIChat._parse_provider_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (30 pts), boolean chains 8, error handling 2 (4 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp._locate_component (cognitive 44) · ×1
  • mcp._locate_component (cognitive 44) libs/agno/agno/os/mcp.py:1644 — mcp._locate_component has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (8 pts), boolean chains 6, ternaries 2 (6 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · mcp._register_exposed_components (cognitive 44) · ×1
  • mcp._register_exposed_components (cognitive 44) libs/agno/agno/os/mcp.py:1934 — mcp._register_exposed_components has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 6 (12 pts), boolean chains 9, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _utils._deep_copy_field (cognitive 44) · ×1
  • _utils._deep_copy_field (cognitive 44) libs/agno/agno/team/_utils.py:163 — _utils._deep_copy_field has cognitive complexity 44 (threshold 15). Drivers by points: error handling 8 (20 pts), if/else 11 (17 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Function._build_from_callable (cognitive 44) · ×1
  • Function._build_from_callable (cognitive 44) libs/agno/agno/tools/function.py:1473 — Function._build_from_callable has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 12, loops 2 (4 pts), error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPTools.__init__ (cognitive 44) · ×1
  • MCPTools.__init__ (cognitive 44) libs/agno/agno/tools/mcp/mcp.py:253 — MCPTools.__init__ has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 10, ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · claude._format_file_for_message (cognitive 44) · ×1
  • claude._format_file_for_message (cognitive 44) libs/agno/agno/utils/models/claude.py:363 — claude._format_file_for_message has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 7, ternaries 3 (7 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pprint.pprint_run_response (cognitive 44) · ×1
  • pprint.pprint_run_response (cognitive 44) libs/agno/agno/utils/pprint.py:13 — pprint.pprint_run_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 3 (11 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (pprint.apprint_run_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · pprint.apprint_run_response (cognitive 44) · ×1
  • pprint.apprint_run_response (cognitive 44) libs/agno/agno/utils/pprint.py:97 — pprint.apprint_run_response has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 3 (11 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (pprint.pprint_run_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · disruption_catchup.test_full_catchup (cognitive 44) · ×1
  • disruption_catchup.test_full_catchup (cognitive 44) cookbook/04_workflows/06_advanced_concepts/long_running/disruption_catchup.py:36 — disruption_catchup.test_full_catchup has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (39 pts), error handling 2, loops 2, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · refresh.arefresh_product (cognitive 43) · ×1
  • refresh.arefresh_product (cognitive 43) libs/agno/agno/company/refresh.py:54 — refresh.arefresh_product has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 6, loops 5 (6 pts), ternaries 2 (6 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.create_component_with_config (cognitive 43) · ×1
  • PostgresDb.create_component_with_config (cognitive 43) libs/agno/agno/db/postgres/postgres.py:5126 — PostgresDb.create_component_with_config has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 4 (8 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.create_component_with_config (cognitive 43) · ×1
  • SqliteDb.create_component_with_config (cognitive 43) REDACTED:4966 — SqliteDb.create_component_with_config has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 4 (8 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocumentChunking.chunk (cognitive 43) · ×1
  • DocumentChunking.chunk (cognitive 43) libs/agno/agno/knowledge/chunking/document.py:18 — DocumentChunking.chunk has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 3 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore._format_entity_hit (cognitive 43) · ×1
  • EntityMemoryStore._format_entity_hit (cognitive 43) libs/agno/agno/learn/stores/entity_memory.py:2000 — EntityMemoryStore._format_entity_hit has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 8 (19 pts), if/else 10 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteLLM.parse_tool_calls (cognitive 43) · ×1
  • LiteLLM.parse_tool_calls (cognitive 43) libs/agno/agno/models/litellm/chat.py:433 — LiteLLM.parse_tool_calls has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (35 pts), error handling 1 (4 pts), boolean chains 2, loops 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AuthMiddleware._check_scopes (cognitive 43) · ×1
  • AuthMiddleware._check_scopes (cognitive 43) libs/agno/agno/os/middleware/jwt.py:1078 — AuthMiddleware._check_scopes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 3 (9 pts), ternaries 4 (9 pts), boolean chains 6 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AuthMiddleware._acheck_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AuthMiddleware._acheck_scopes (cognitive 43) · ×1
  • AuthMiddleware._acheck_scopes (cognitive 43) libs/agno/agno/os/middleware/jwt.py:1278 — AuthMiddleware._acheck_scopes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 3 (9 pts), ternaries 4 (9 pts), boolean chains 6 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AuthMiddleware._check_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.collect_mcp_tools_from_team (cognitive 43) · ×1
  • utils.collect_mcp_tools_from_team (cognitive 43) libs/agno/agno/os/utils.py:2315 — utils.collect_mcp_tools_from_team has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (29 pts), loops 3 (9 pts), boolean chains 5 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · approval._build_approval_dict (cognitive 43) · ×1
  • approval._build_approval_dict (cognitive 43) libs/agno/agno/run/approval.py:117 — approval._build_approval_dict has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 8, loops 3 (6 pts), ternaries 5 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools.__init__ (cognitive 43) · ×1
  • StudioTools.__init__ (cognitive 43) libs/agno/agno/tools/studio.py:271 — StudioTools.__init__ has cognitive complexity 43 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 7, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · YouTools._format_results (cognitive 43) · ×1
  • YouTools._format_results (cognitive 43) libs/agno/agno/tools/youcom.py:180 — YouTools._format_results has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · media_offload.iter_run_media (cognitive 43) · ×1
  • media_offload.iter_run_media (cognitive 43) libs/agno/agno/utils/media_offload.py:749 — media_offload.iter_run_media has cognitive complexity 43 (threshold 15). Drivers by points: loops 16 (30 pts), boolean chains 9, if/else 3 (4 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · LanceDb.async_upsert (cognitive 43) · ×1
  • LanceDb.async_upsert (cognitive 43) REDACTED:523 — LanceDb.async_upsert has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 3 (11 pts), ternaries 1 (5 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run._continue_run (cognitive 42) · ×1
  • _run._continue_run (cognitive 42) libs/agno/agno/agent/_run.py:3650 — _run._continue_run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (20 pts), error handling 7 (17 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner.arun_rollouts (cognitive 42) · ×1
  • runner.arun_rollouts (cognitive 42) libs/agno/agno/environments/runner.py:947 — runner.arun_rollouts has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (27 pts), error handling 3 (5 pts), ternaries 4, boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · helpers.upload_and_send_media_async (cognitive 42) · ×1
  • helpers.upload_and_send_media_async (cognitive 42) libs/agno/agno/os/interfaces/whatsapp/helpers.py:359 — helpers.upload_and_send_media_async has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 9, ternaries 2 (5 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _default_tools.aget_relevant_docs_from_knowledge (cognitive 42) · ×1
  • _default_tools.aget_relevant_docs_from_knowledge (cognitive 42) libs/agno/agno/team/_default_tools.py:1866 — _default_tools.aget_relevant_docs_from_knowledge has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 6, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._route_requirements_to_members_stream (cognitive 42) · ×1
  • _run._route_requirements_to_members_stream (cognitive 42) libs/agno/agno/team/_run.py:6469 — _run._route_requirements_to_members_stream has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 10, loops 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_run._aroute_requirements_to_members_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._aroute_requirements_to_members_stream (cognitive 42) · ×1
  • _run._aroute_requirements_to_members_stream (cognitive 42) libs/agno/agno/team/_run.py:6666 — _run._aroute_requirements_to_members_stream has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 10, loops 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_run._route_requirements_to_members_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Workspace._list_files (cognitive 42) · ×1
  • Workspace._list_files (cognitive 42) libs/agno/agno/tools/workspace.py:736 — Workspace._list_files has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 3 (6 pts), ternaries 2 (4 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb._create_search_index (cognitive 42) · ×1
  • MongoDb._create_search_index (cognitive 42) REDACTED:257 — MongoDb._create_search_index has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (20 pts), error handling 4 (12 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._run_workflow_agent_stream (cognitive 42) · ×1
  • Workflow._run_workflow_agent_stream (cognitive 42) libs/agno/agno/workflow/workflow.py:5775 — Workflow._run_workflow_agent_stream has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 5 (12 pts), boolean chains 5, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CacheCluster._create (cognitive 42) · ×1
  • CacheCluster._create (cognitive 42) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:131 — CacheCluster._create has cognitive complexity 42 (threshold 15). Drivers by points: if/else 34 (37 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _hooks.aexecute_pre_hooks (cognitive 41) · ×1
  • _hooks.aexecute_pre_hooks (cognitive 41) libs/agno/agno/agent/_hooks.py:154 — _hooks.aexecute_pre_hooks has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 4 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks.aexecute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _hooks.aexecute_post_hooks (cognitive 41) · ×1
  • _hooks.aexecute_post_hooks (cognitive 41) libs/agno/agno/agent/_hooks.py:363 — _hooks.aexecute_post_hooks has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 4 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks.aexecute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _response.update_run_response (cognitive 41) · ×1
  • _response.update_run_response (cognitive 41) libs/agno/agno/agent/_response.py:946 — _response.update_run_response has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (28 pts), loops 2 (5 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeAgent._aquery_sdk (cognitive 41) · ×1
  • ClaudeAgent._aquery_sdk (cognitive 41) libs/agno/agno/agents/claude/agent.py:457 — ClaudeAgent._aquery_sdk has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 6, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.get_traces (cognitive 41) · ×1
  • GcsJsonDb.get_traces (cognitive 41) libs/agno/agno/db/gcs_json/gcs_json_db.py:1738 — GcsJsonDb.get_traces has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 8, loops 2, error handling 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_traces (cognitive 41) · ×1
  • JsonDb.get_traces (cognitive 41) libs/agno/agno/db/json/json_db.py:1838 — JsonDb.get_traces has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 8, loops 2, error handling 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.get_traces (cognitive 41) · ×1
  • ValkeyDb.get_traces (cognitive 41) libs/agno/agno/db/valkey/valkey.py:2600 — ValkeyDb.get_traces has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 10, error handling 2, loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _hooks._aexecute_pre_hooks (cognitive 41) · ×1
  • _hooks._aexecute_pre_hooks (cognitive 41) libs/agno/agno/team/_hooks.py:338 — _hooks._aexecute_pre_hooks has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 4 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks._aexecute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _hooks._aexecute_post_hooks (cognitive 41) · ×1
  • _hooks._aexecute_post_hooks (cognitive 41) libs/agno/agno/team/_hooks.py:536 — _hooks._aexecute_post_hooks has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 4 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks._aexecute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._continue_run (cognitive 41) · ×1
  • _run._continue_run (cognitive 41) libs/agno/agno/team/_run.py:8168 — _run._continue_run has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (20 pts), error handling 7 (17 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage._hydrate_from_graph (cognitive 41) · ×1
  • _storage._hydrate_from_graph (cognitive 41) libs/agno/agno/team/_storage.py:1527 — _storage._hydrate_from_graph has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 3 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tokens._count_message_tokens (cognitive 41) · ×1
  • tokens._count_message_tokens (cognitive 41) REDACTED:553 — tokens._count_message_tokens has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 2 (12 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Condition.execute (cognitive 41) · ×1
  • Condition.execute (cognitive 41) libs/agno/agno/workflow/condition.py:474 — Condition.execute has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), error handling 3 (6 pts), boolean chains 2, ternaries 2, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Condition.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Condition.aexecute (cognitive 41) · ×1
  • Condition.aexecute (cognitive 41) libs/agno/agno/workflow/condition.py:929 — Condition.aexecute has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), error handling 3 (6 pts), boolean chains 2, ternaries 2, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Condition.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Workflow.deep_copy (cognitive 41) · ×1
  • Workflow.deep_copy (cognitive 41) libs/agno/agno/workflow/workflow.py:11682 — Workflow.deep_copy has cognitive complexity 41 (threshold 15). Drivers by points: error handling 6 (23 pts), if/else 7 (14 pts), boolean chains 3, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EcsService._update (cognitive 41) · ×1
  • EcsService._update (cognitive 41) libs/agno_infra/agno/aws/resource/ecs/service.py:335 — EcsService._update has cognitive complexity 41 (threshold 15). Drivers by points: if/else 23 (32 pts), loops 2 (6 pts), boolean chains 2, error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages.get_relevant_docs_from_knowledge (cognitive 40) · ×1
  • _messages.get_relevant_docs_from_knowledge (cognitive 40) libs/agno/agno/agent/_messages.py:2523 — _messages.get_relevant_docs_from_knowledge has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (25 pts), ternaries 4 (7 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb.get_traces (cognitive 40) · ×1
  • RedisDb.get_traces (cognitive 40) libs/agno/agno/db/redis/redis.py:2122 — RedisDb.get_traces has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 9, loops 2, error handling 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._add_router (cognitive 40) · ×1
  • AgentOS._add_router (cognitive 40) libs/agno/agno/os/app.py:2611 — AgentOS._add_router has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 5 (16 pts), boolean chains 2 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PublicMiddleware._validate_form (cognitive 40) · ×1
  • PublicMiddleware._validate_form (cognitive 40) libs/agno/agno/os/public/_middleware.py:122 — PublicMiddleware._validate_form has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 9, error handling 3 (5 pts), ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunRequirement.provide_user_feedback (cognitive 40) · ×1
  • RunRequirement.provide_user_feedback (cognitive 40) libs/agno/agno/run/requirement.py:146 — RunRequirement.provide_user_feedback has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 4 (16 pts), boolean chains 2 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Function.process_entrypoint (cognitive 40) · ×1
  • Function.process_entrypoint (cognitive 40) libs/agno/agno/tools/function.py:1624 — Function.process_entrypoint has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (26 pts), error handling 4 (7 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackTools.__init__ (cognitive 40) · ×1
  • SlackTools.__init__ (cognitive 40) libs/agno/agno/tools/slack.py:141 — SlackTools.__init__ has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 16, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · openai.audio_to_message (cognitive 40) · ×1
  • openai.audio_to_message (cognitive 40) libs/agno/agno/utils/openai.py:10 — openai.audio_to_message has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (28 pts), error handling 2 (9 pts), boolean chains 2, loops 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CouchbaseSearch.async_insert (cognitive 40) · ×1
  • CouchbaseSearch.async_insert (cognitive 40) REDACTED:1074 — CouchbaseSearch.async_insert has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (9 pts), error handling 3 (7 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CouchbaseSearch._async_upsert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CouchbaseSearch._async_upsert (cognitive 40) · ×1
  • CouchbaseSearch._async_upsert (cognitive 40) REDACTED:1190 — CouchbaseSearch._async_upsert has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (9 pts), error handling 3 (7 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CouchbaseSearch.async_insert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · EntityMemoryStore._apply_remember (cognitive 39) · ×1
  • EntityMemoryStore._apply_remember (cognitive 39) libs/agno/agno/learn/stores/entity_memory.py:1561 — EntityMemoryStore._apply_remember has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 13, loops 3, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · diagnostics.arun_diagnostics (cognitive 39) · ×1
  • diagnostics.arun_diagnostics (cognitive 39) libs/agno/agno/os/diagnostics.py:83 — diagnostics.arun_diagnostics has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 4 (9 pts), loops 4 (7 pts), error handling 2 (5 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · approval._apply_approval_to_tools (cognitive 39) · ×1
  • approval._apply_approval_to_tools (cognitive 39) libs/agno/agno/run/approval.py:421 — approval._apply_approval_to_tools has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EcsContainer.get_container_definition (cognitive 39) · ×1
  • EcsContainer.get_container_definition (cognitive 39) libs/agno_infra/agno/aws/resource/ecs/container.py:93 — EcsContainer.get_container_definition has cognitive complexity 39 (threshold 15). Drivers by points: if/else 39. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ClaudeAgent._build_continuation (cognitive 38) · ×1
  • ClaudeAgent._build_continuation (cognitive 38) libs/agno/agno/agents/claude/agent.py:728 — ClaudeAgent._build_continuation has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 9, ternaries 7 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAgent._tool_result_from_item (cognitive 38) · ×1
  • CodexAgent._tool_result_from_item (cognitive 38) libs/agno/agno/agents/codex/agent.py:1139 — CodexAgent._tool_result_from_item has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AccuracyEval.run_with_output (cognitive 38) · ×1
  • AccuracyEval.run_with_output (cognitive 38) libs/agno/agno/eval/accuracy.py:648 — AccuracyEval.run_with_output has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 6 (20 pts), if/else 10 (16 pts), boolean chains 2 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · suite.acli (cognitive 38) · ×1
  • suite.acli (cognitive 38) libs/agno/agno/eval/suite.py:854 — suite.acli has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 6 (13 pts), error handling 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · filters.from_dict (cognitive 38) · ×1
  • filters.from_dict (cognitive 38) libs/agno/agno/filters.py:397 — filters.from_dict has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 10 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIResponses.get_request_params (cognitive 38) · ×1
  • OpenAIResponses.get_request_params (cognitive 38) libs/agno/agno/models/openai/responses.py:336 — OpenAIResponses.get_request_params has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseWorkflowRunOutputEvent.to_dict (cognitive 38) · ×1
  • BaseWorkflowRunOutputEvent.to_dict (cognitive 38) libs/agno/agno/run/workflow.py:103 — BaseWorkflowRunOutputEvent.to_dict has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 6 (12 pts), boolean chains 10, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._continue_run_dispatch_stream_with_member_events (cognitive 38) · ×1
  • _run._continue_run_dispatch_stream_with_member_events (cognitive 38) libs/agno/agno/team/_run.py:7967 — _run._continue_run_dispatch_stream_with_member_events has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 9, error handling 5 (7 pts), ternaries 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileTools.search_content (cognitive 38) · ×1
  • FileTools.search_content (cognitive 38) libs/agno/agno/tools/file/file.py:350 — FileTools.search_content has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 4 (10 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleSlidesTools.__init__ (cognitive 38) · ×1
  • GoogleSlidesTools.__init__ (cognitive 38) libs/agno/agno/tools/google/slides.py:87 — GoogleSlidesTools.__init__ has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20, boolean chains 18. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SuperserveTools.__init__ (cognitive 38) · ×1
  • SuperserveTools.__init__ (cognitive 38) libs/agno/agno/tools/superserve.py:62 — SuperserveTools.__init__ has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 20, if/else 17, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · agent.get_last_run_output_util (cognitive 38) · ×1
  • agent.get_last_run_output_util (cognitive 38) libs/agno/agno/utils/agent.py:886 — agent.get_last_run_output_util has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Parallel.aexecute_stream (cognitive 38) · ×1
  • Parallel.aexecute_stream (cognitive 38) libs/agno/agno/workflow/parallel.py:823 — Parallel.aexecute_stream has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 13, loops 4 (6 pts), error handling 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _utils.deep_copy_field (cognitive 37) · ×1
  • _utils.deep_copy_field (cognitive 37) libs/agno/agno/agent/_utils.py:181 — _utils.deep_copy_field has cognitive complexity 37 (threshold 15). Drivers by points: error handling 8 (20 pts), if/else 9 (12 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.get_eval_runs (cognitive 37) · ×1
  • GcsJsonDb.get_eval_runs (cognitive 37) libs/agno/agno/db/gcs_json/gcs_json_db.py:1480 — GcsJsonDb.get_eval_runs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 9, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.get_eval_runs (cognitive 37) · ×1
  • InMemoryDb.get_eval_runs (cognitive 37) libs/agno/agno/db/in_memory/in_memory_db.py:1299 — InMemoryDb.get_eval_runs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 9, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_eval_runs (cognitive 37) · ×1
  • JsonDb.get_eval_runs (cognitive 37) libs/agno/agno/db/json/json_db.py:1580 — JsonDb.get_eval_runs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 9, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_trace_stats (cognitive 37) · ×1
  • JsonDb.get_trace_stats (cognitive 37) libs/agno/agno/db/json/json_db.py:1931 — JsonDb.get_trace_stats has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 7, loops 2, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MigrationManager.down (cognitive 37) · ×1
  • MigrationManager.down (cognitive 37) libs/agno/agno/db/migrations/manager.py:157 — MigrationManager.down has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (29 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.get_all_keys_for_table (cognitive 37) · ×1
  • utils.get_all_keys_for_table (cognitive 37) libs/agno/agno/db/valkey/utils.py:63 — utils.get_all_keys_for_table has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 4 (10 pts), ternaries 2 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge._validate_filters (cognitive 37) · ×1
  • Knowledge._validate_filters (cognitive 37) libs/agno/agno/knowledge/knowledge.py:1794 — Knowledge._validate_filters has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 2 (7 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionMetrics.accumulate_from_run (cognitive 37) · ×1
  • SessionMetrics.accumulate_from_run (cognitive 37) libs/agno/agno/metrics.py:505 — SessionMetrics.accumulate_from_run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (11 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PublicSurface._bind (cognitive 37) · ×1
  • PublicSurface._bind (cognitive 37) libs/agno/agno/os/public/__init__.py:76 — PublicSurface._bind has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _default_tools.get_relevant_docs_from_knowledge (cognitive 37) · ×1
  • _default_tools.get_relevant_docs_from_knowledge (cognitive 37) libs/agno/agno/team/_default_tools.py:1763 — _default_tools.get_relevant_docs_from_knowledge has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 5, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response.convert_response_to_structured_format (cognitive 36) · ×1
  • _response.convert_response_to_structured_format (cognitive 36) libs/agno/agno/agent/_response.py:904 — _response.convert_response_to_structured_format has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (30 pts), error handling 1 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AsyncMySQLDb._create_table (cognitive 36) · ×1
  • AsyncMySQLDb._create_table (cognitive 36) libs/agno/agno/db/mysql/async_mysql.py:173 — AsyncMySQLDb._create_table has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 6 (7 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MySQLDb._create_table (cognitive 36) · ×1
  • MySQLDb._create_table (cognitive 36) libs/agno/agno/db/mysql/mysql.py:169 — MySQLDb._create_table has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 6 (7 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sources.validate_source_fields (cognitive 36) · ×1
  • sources.validate_source_fields (cognitive 36) libs/agno/agno/db/schemas/sources.py:8 — sources.validate_source_fields has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 14, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.get_eval_runs (cognitive 36) · ×1
  • ValkeyDb.get_eval_runs (cognitive 36) libs/agno/agno/db/valkey/valkey.py:2254 — ValkeyDb.get_eval_runs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 10, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCorpus.__getitem__ (cognitive 36) · ×1
  • PageCorpus.__getitem__ (cognitive 36) libs/agno/agno/knowledge/page/filesystem.py:356 — PageCorpus.__getitem__ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 4, loops 2 (4 pts), ternaries 4, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metrics.accumulate_eval_metrics (cognitive 36) · ×1
  • metrics.accumulate_eval_metrics (cognitive 36) libs/agno/agno/metrics.py:714 — metrics.accumulate_eval_metrics has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (9 pts), ternaries 2 (5 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemini._format_tool_result_media (cognitive 36) · ×1
  • Gemini._format_tool_result_media (cognitive 36) libs/agno/agno/models/google/gemini.py:970 — Gemini._format_tool_result_media has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.map_run_output_to_a2a_task (cognitive 36) · ×1
  • utils.map_run_output_to_a2a_task (cognitive 36) libs/agno/agno/os/interfaces/a2a/utils.py:195 — utils.map_run_output_to_a2a_task has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4 (8 pts), boolean chains 6, ternaries 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages.get_members_system_message_content (cognitive 36) · ×1
  • _messages.get_members_system_message_content (cognitive 36) libs/agno/agno/team/_messages.py:99 — _messages.get_members_system_message_content has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (34 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._group_requirements_for_continue (cognitive 36) · ×1
  • _run._group_requirements_for_continue (cognitive 36) libs/agno/agno/team/_run.py:6262 — _run._group_requirements_for_continue has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agentos._normalize_eval_run (cognitive 36) · ×1
  • agentos._normalize_eval_run (cognitive 36) libs/agno/agno/tools/agentos.py:835 — agentos._normalize_eval_run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 10, ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NanoBananaTools.create_image (cognitive 36) · ×1
  • NanoBananaTools.create_image (cognitive 36) libs/agno/agno/tools/nano_banana.py:70 — NanoBananaTools.create_image has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, error handling 2 (5 pts), ternaries 1 (5 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShopifyTools.get_sales_trends (cognitive 36) · ×1
  • ShopifyTools.get_sales_trends (cognitive 36) libs/agno/agno/tools/shopify.py:1176 — ShopifyTools.get_sales_trends has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 6 (20 pts), if/else 11 (16 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · StudioTools.get_component (cognitive 36) · ×1
  • StudioTools.get_component (cognitive 36) libs/agno/agno/tools/studio.py:1987 — StudioTools.get_component has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 4 (8 pts), boolean chains 5, error handling 3 (4 pts), ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._links_for_component (cognitive 36) · ×1
  • StudioTools._links_for_component (cognitive 36) libs/agno/agno/tools/studio.py:5291 — StudioTools._links_for_component has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 6 (14 pts), loops 3 (6 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.aget_last_run_output_util (cognitive 36) · ×1
  • agent.aget_last_run_output_util (cognitive 36) libs/agno/agno/utils/agent.py:937 — agent.aget_last_run_output_util has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LanceDb.__init__ (cognitive 36) · ×1
  • LanceDb.__init__ (cognitive 36) REDACTED:46 — LanceDb.__init__ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 8, error handling 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _hooks.execute_pre_hooks (cognitive 35) · ×1
  • _hooks.execute_pre_hooks (cognitive 35) libs/agno/agno/agent/_hooks.py:43 — _hooks.execute_pre_hooks has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 4 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks.execute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _hooks.execute_post_hooks (cognitive 35) · ×1
  • _hooks.execute_post_hooks (cognitive 35) libs/agno/agno/agent/_hooks.py:262 — _hooks.execute_post_hooks has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 4 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks.execute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _CompanyScheduleExecutor._complete_projects (cognitive 35) · ×1
  • _CompanyScheduleExecutor._complete_projects (cognitive 35) libs/agno/agno/company/routines.py:707 — _CompanyScheduleExecutor._complete_projects has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 3 (11 pts), boolean chains 7, if/else 2 (7 pts), loops 3 (6 pts), error handling 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _CompanyScheduleExecutor._dispatch (cognitive 35) · ×1
  • _CompanyScheduleExecutor._dispatch (cognitive 35) libs/agno/agno/company/routines.py:939 — _CompanyScheduleExecutor._dispatch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 7, ternaries 3 (4 pts), error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · utils.filter_expr_to_clickhouse (cognitive 35) · ×1
  • utils.filter_expr_to_clickhouse (cognitive 35) libs/agno/agno/db/clickhouse/utils.py:175 — utils.filter_expr_to_clickhouse has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 5, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.cleanup_legacy_runs_field (cognitive 35) · ×1
  • DynamoDb.cleanup_legacy_runs_field (cognitive 35) libs/agno/agno/db/dynamo/dynamo.py:360 — DynamoDb.cleanup_legacy_runs_field has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (23 pts), error handling 3 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.delete_config (cognitive 35) · ×1
  • PostgresDb.delete_config (cognitive 35) libs/agno/agno/db/postgres/postgres.py:5879 — PostgresDb.delete_config has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 9, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb.enqueue_job (cognitive 35) · ×1
  • RedisDb.enqueue_job (cognitive 35) libs/agno/agno/db/redis/redis.py:2563 — RedisDb.enqueue_job has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 3 (6 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.delete_config (cognitive 35) · ×1
  • SqliteDb.delete_config (cognitive 35) REDACTED:5668 — SqliteDb.delete_config has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 9, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.get_trace_stats (cognitive 35) · ×1
  • ValkeyDb.get_trace_stats (cognitive 35) libs/agno/agno/db/valkey/valkey.py:2701 — ValkeyDb.get_trace_stats has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 7, error handling 2, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore.build_context (cognitive 35) · ×1
  • EntityMemoryStore.build_context (cognitive 35) libs/agno/agno/learn/stores/entity_memory.py:702 — EntityMemoryStore.build_context has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, error handling 1 (4 pts), loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemini._format_audio_for_message (cognitive 35) · ×1
  • Gemini._format_audio_for_message (cognitive 35) libs/agno/agno/models/google/gemini.py:1018 — Gemini._format_audio_for_message has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, loops 1 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPRoutingMiddleware.__call__ (cognitive 35) · ×1
  • MCPRoutingMiddleware.__call__ (cognitive 35) libs/agno/agno/os/middleware/mcp_routing.py:45 — MCPRoutingMiddleware.__call__ has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 10, loops 1 (2 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowRunOutput.from_dict (cognitive 35) · ×1
  • WorkflowRunOutput.from_dict (cognitive 35) libs/agno/agno/run/workflow.py:1002 — WorkflowRunOutput.from_dict has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (26 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolCallScorer.score (cognitive 35) · ×1
  • ToolCallScorer.score (cognitive 35) libs/agno/agno/scorer/tools.py:80 — ToolCallScorer.score has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 7, loops 3 (6 pts), ternaries 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowSession.get_messages (cognitive 35) · ×1
  • WorkflowSession.get_messages (cognitive 35) libs/agno/agno/session/workflow.py:447 — WorkflowSession.get_messages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 4 (12 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._get_run_messages (cognitive 35) · ×1
  • _messages._get_run_messages (cognitive 35) libs/agno/agno/team/_messages.py:944 — _messages._get_run_messages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 3 (6 pts), error handling 1 (4 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_messages._aget_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _messages._aget_run_messages (cognitive 35) · ×1
  • _messages._aget_run_messages (cognitive 35) libs/agno/agno/team/_messages.py:1079 — _messages._aget_run_messages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 3 (6 pts), error handling 1 (4 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_messages._get_run_messages) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._handle_team_run_cancellation (cognitive 35) · ×1
  • _run._handle_team_run_cancellation (cognitive 35) libs/agno/agno/team/_run.py:4391 — _run._handle_team_run_cancellation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._curated_config_view (cognitive 35) · ×1
  • StudioTools._curated_config_view (cognitive 35) libs/agno/agno/tools/studio.py:1664 — StudioTools._curated_config_view has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 9, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · callables._aclose_cached_resources (cognitive 35) · ×1
  • callables._aclose_cached_resources (cognitive 35) libs/agno/agno/utils/callables.py:547 — callables._aclose_cached_resources has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 3 (6 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mistral.format_messages (cognitive 35) · ×1
  • mistral.format_messages (cognitive 35) libs/agno/agno/utils/models/mistral.py:49 — mistral.format_messages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Weaviate.async_insert (cognitive 35) · ×1
  • Weaviate.async_insert (cognitive 35) REDACTED:364 — Weaviate.async_insert has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 3 (7 pts), ternaries 2 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · infra_cli.patch (cognitive 35) · ×1
  • infra_cli.patch (cognitive 35) libs/agno_infra/agno/cli/infra_cli.py:467 — infra_cli.patch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · operator.create_infra_from_template (cognitive 35) · ×1
  • operator.create_infra_from_template (cognitive 35) libs/agno_infra/agno/infra/operator.py:32 — operator.create_infra_from_template has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (24 pts), error handling 3 (5 pts), loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 03_step_user_input_streaming.handle_hitl_pause (cognitive 35) · ×1
  • 03_step_user_input_streaming.handle_hitl_pause (cognitive 35) cookbook/04_workflows/08_human_in_the_loop/user_input/03_step_user_input_streaming.py:108 — 03_step_user_input_streaming.handle_hitl_pause has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 3 (12 pts), loops 3 (5 pts), error handling 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sources.browse_source (cognitive 34) · ×1
  • sources.browse_source (cognitive 34) libs/agno/agno/company/sources.py:104 — sources.browse_source has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_trace_stats (cognitive 34) · ×1
  • DynamoDb.get_trace_stats (cognitive 34) libs/agno/agno/db/dynamo/dynamo.py:2857 — DynamoDb.get_trace_stats has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 3, boolean chains 2, ternaries 2, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.calculate_date_metrics (cognitive 34) · ×1
  • utils.calculate_date_metrics (cognitive 34) libs/agno/agno/db/sqlite/utils.py:244 — utils.calculate_date_metrics has cognitive complexity 34 (threshold 15). Drivers by points: loops 6 (13 pts), if/else 3 (11 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.get_knowledge_instance (cognitive 34) · ×1
  • utils.get_knowledge_instance (cognitive 34) libs/agno/agno/os/utils.py:884 — utils.get_knowledge_instance has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseRunOutputEvent.from_dict (cognitive 34) · ×1
  • BaseRunOutputEvent.from_dict (cognitive 34) libs/agno/agno/run/base.py:253 — BaseRunOutputEvent.from_dict has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24 (28 pts), ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _run._merge_requirement_decision (cognitive 34) · ×1
  • _run._merge_requirement_decision (cognitive 34) libs/agno/agno/team/_run.py:5786 — _run._merge_requirement_decision has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 9, loops 2 (3 pts), ternaries 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FunctionCall._execute (cognitive 34) · ×1
  • FunctionCall._execute (cognitive 34) libs/agno/agno/tools/function.py:2611 — FunctionCall._execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 7, ternaries 3 (7 pts), error handling 4 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GithubTools.get_repository_with_stats (cognitive 34) · ×1
  • GithubTools.get_repository_with_stats (cognitive 34) libs/agno/agno/tools/github.py:994 — GithubTools.get_repository_with_stats has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 7 (8 pts), loops 6, ternaries 6, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GmailTools._extract_body (cognitive 34) · ×1
  • GmailTools._extract_body (cognitive 34) libs/agno/agno/tools/google/gmail.py:1364 — GmailTools._extract_body has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 3, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioRunnerTools._check_references (cognitive 34) · ×1
  • StudioRunnerTools._check_references (cognitive 34) libs/agno/agno/tools/studio_runner.py:1419 — StudioRunnerTools._check_references has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 3 (5 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramTools.__init__ (cognitive 34) · ×1
  • TelegramTools.__init__ (cognitive 34) libs/agno/agno/tools/telegram.py:41 — TelegramTools.__init__ has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 16, if/else 16, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · workflow.print_response (cognitive 34) · ×1
  • workflow.print_response (cognitive 34) libs/agno/agno/utils/print_response/workflow.py:44 — workflow.print_response has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (19 pts), ternaries 5 (9 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (workflow.aprint_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · workflow.aprint_response (cognitive 34) · ×1
  • workflow.aprint_response (cognitive 34) libs/agno/agno/utils/print_response/workflow.py:905 — workflow.aprint_response has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (19 pts), ternaries 5 (9 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (workflow.print_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · events_replay.test_replay (cognitive 34) · ×1
  • events_replay.test_replay (cognitive 34) cookbook/04_workflows/06_advanced_concepts/long_running/events_replay.py:38 — events_replay.test_replay has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 2, error handling 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAgent._acollect_turn (cognitive 33) · ×1
  • CodexAgent._acollect_turn (cognitive 33) libs/agno/agno/agents/codex/agent.py:785 — CodexAgent._acollect_turn has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 3, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · A2AClient._build_message_request (cognitive 33) · ×1
  • A2AClient._build_message_request (cognitive 33) libs/agno/agno/client/a2a/client.py:74 — A2AClient._build_message_request has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 4 (8 pts), boolean chains 4, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncPostgresDb.get_trace_stats (cognitive 33) · ×1
  • AsyncPostgresDb.get_trace_stats (cognitive 33) libs/agno/agno/db/postgres/async_postgres.py:3507 — AsyncPostgresDb.get_trace_stats has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 4 (8 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PostgresDb.get_trace_stats (cognitive 33) · ×1
  • PostgresDb.get_trace_stats (cognitive 33) libs/agno/agno/db/postgres/postgres.py:4048 — PostgresDb.get_trace_stats has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 4 (8 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RedisDb.get_eval_runs (cognitive 33) · ×1
  • RedisDb.get_eval_runs (cognitive 33) libs/agno/agno/db/redis/redis.py:1824 — RedisDb.get_eval_runs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 9, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb._q_scan_claim (cognitive 33) · ×1
  • RedisDb._q_scan_claim (cognitive 33) libs/agno/agno/db/redis/redis.py:2676 — RedisDb._q_scan_claim has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (22 pts), error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.delete_eval_runs (cognitive 33) · ×1
  • ValkeyDb.delete_eval_runs (cognitive 33) libs/agno/agno/db/valkey/valkey.py:2147 — ValkeyDb.delete_eval_runs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 3 (6 pts), boolean chains 4, loops 3 (4 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AccuracyEval.run (cognitive 33) · ×1
  • AccuracyEval.run (cognitive 33) libs/agno/agno/eval/accuracy.py:359 — AccuracyEval.run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCoordinator._embedding_pages (cognitive 33) · ×1
  • PageCoordinator._embedding_pages (cognitive 33) REDACTED:712 — PageCoordinator._embedding_pages has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 3 (9 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LearningMachine._deserialize_store_config (cognitive 33) · ×1
  • LearningMachine._deserialize_store_config (cognitive 33) libs/agno/agno/learn/machine.py:1166 — LearningMachine._deserialize_store_config has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 4 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model._populate_assistant_message (cognitive 33) · ×1
  • Model._populate_assistant_message (cognitive 33) REDACTED:1247 — Model._populate_assistant_message has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.agent_continue_response_streamer (cognitive 33) · ×1
  • router.agent_continue_response_streamer (cognitive 33) libs/agno/agno/os/routers/agents/router.py:290 — router.agent_continue_response_streamer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (8 pts), boolean chains 7, error handling 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _hooks._execute_pre_hooks (cognitive 33) · ×1
  • _hooks._execute_pre_hooks (cognitive 33) libs/agno/agno/team/_hooks.py:240 — _hooks._execute_pre_hooks has cognitive complexity 33 (threshold 15). Drivers by points: error handling 4 (12 pts), if/else 7 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks._execute_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _hooks._execute_post_hooks (cognitive 33) · ×1
  • _hooks._execute_post_hooks (cognitive 33) libs/agno/agno/team/_hooks.py:441 — _hooks._execute_post_hooks has cognitive complexity 33 (threshold 15). Drivers by points: error handling 4 (12 pts), if/else 7 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_hooks._execute_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · apify.props_to_json_schema (cognitive 33) · ×1
  • apify.props_to_json_schema (cognitive 33) libs/agno/agno/tools/apify.py:134 — apify.props_to_json_schema has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SnapshotManager.restore (cognitive 33) · ×1
  • SnapshotManager.restore (cognitive 33) libs/agno/agno/tools/code/snapshot.py:411 — SnapshotManager.restore has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 4 (6 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OxylabsTools.search_google (cognitive 33) · ×1
  • OxylabsTools.search_google (cognitive 33) libs/agno/agno/tools/oxylabs.py:91 — OxylabsTools.search_google has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (8 pts), boolean chains 7, ternaries 1 (4 pts), error handling 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workspace._search_content (cognitive 33) · ×1
  • Workspace._search_content (cognitive 33) libs/agno/agno/tools/workspace.py:815 — Workspace._search_content has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 3 (7 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChromaDb.async_insert (cognitive 33) · ×1
  • ChromaDb.async_insert (cognitive 33) REDACTED:454 — ChromaDb.async_insert has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 2 (5 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ChromaDb._async_upsert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ChromaDb._async_upsert (cognitive 33) · ×1
  • ChromaDb._async_upsert (cognitive 33) REDACTED:655 — ChromaDb._async_upsert has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 2 (5 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ChromaDb.async_insert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · LanceDb.async_insert (cognitive 33) · ×1
  • LanceDb.async_insert (cognitive 33) REDACTED:429 — LanceDb.async_insert has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (8 pts), ternaries 1 (4 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PineconeDb._prepare_vectors (cognitive 33) · ×1
  • PineconeDb._prepare_vectors (cognitive 33) REDACTED:370 — PineconeDb._prepare_vectors has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 2 (5 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InfraConfig.get_resources_from_file (cognitive 33) · ×1
  • InfraConfig.get_resources_from_file (cognitive 33) libs/agno_infra/agno/infra/config.py:214 — InfraConfig.get_resources_from_file has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 5 (8 pts), boolean chains 1, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb.get_eval_runs (cognitive 32) · ×1
  • FirestoreDb.get_eval_runs (cognitive 32) libs/agno/agno/db/firestore/firestore.py:2032 — FirestoreDb.get_eval_runs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.get_runs (cognitive 32) · ×1
  • InMemoryDb.get_runs (cognitive 32) libs/agno/agno/db/in_memory/in_memory_db.py:496 — InMemoryDb.get_runs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, ternaries 2 (5 pts), error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMongoDb._ensure_client (cognitive 32) · ×1
  • AsyncMongoDb._ensure_client (cognitive 32) libs/agno/agno/db/mongo/async_mongo.py:295 — AsyncMongoDb._ensure_client has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 6, ternaries 1 (3 pts), loops 1 (2 pts), error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMongoDb.upsert_memories (cognitive 32) · ×1
  • AsyncMongoDb.upsert_memories (cognitive 32) libs/agno/agno/db/mongo/async_mongo.py:1751 — AsyncMongoDb.upsert_memories has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.upsert_memories (cognitive 32) · ×1
  • MongoDb.upsert_memories (cognitive 32) libs/agno/agno/db/mongo/mongo.py:1557 — MongoDb.upsert_memories has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb.get_sessions (cognitive 32) · ×1
  • RedisDb.get_sessions (cognitive 32) libs/agno/agno/db/redis/redis.py:711 — RedisDb.get_sessions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SurrealDb.upsert_trace (cognitive 32) · ×1
  • SurrealDb.upsert_trace (cognitive 32) libs/agno/agno/db/surrealdb/surrealdb.py:1767 — SurrealDb.upsert_trace has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 6, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.deserialize_session_json_fields (cognitive 32) · ×1
  • utils.deserialize_session_json_fields (cognitive 32) REDACTED:969 — utils.deserialize_session_json_fields has cognitive complexity 32 (threshold 15). Drivers by points: error handling 8 (16 pts), boolean chains 8, if/else 8 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.get_sessions (cognitive 32) · ×1
  • ValkeyDb.get_sessions (cognitive 32) libs/agno/agno/db/valkey/valkey.py:837 — ValkeyDb.get_sessions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _validate.validate_sft_jsonl (cognitive 32) · ×1
  • _validate.validate_sft_jsonl (cognitive 32) libs/agno/agno/environments/exporters/_validate.py:20 — _validate.validate_sft_jsonl has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AccuracyEval.arun (cognitive 32) · ×1
  • AccuracyEval.arun (cognitive 32) libs/agno/agno/eval/accuracy.py:504 — AccuracyEval.arun has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore._forget_edge (cognitive 32) · ×1
  • EntityMemoryStore._forget_edge (cognitive 32) libs/agno/agno/learn/stores/entity_memory.py:2368 — EntityMemoryStore._forget_edge has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 4 (7 pts), boolean chains 6, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemini._format_video_for_message (cognitive 32) · ×1
  • Gemini._format_video_for_message (cognitive 32) libs/agno/agno/models/google/gemini.py:1081 — Gemini._format_video_for_message has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, loops 1 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MoonShot._format_message (cognitive 32) · ×1
  • MoonShot._format_message (cognitive 32) libs/agno/agno/models/moonshot/moonshot.py:253 — MoonShot._format_message has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 2 (6 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AuthMiddleware._deny_for_schedule_owner (cognitive 32) · ×1
  • AuthMiddleware._deny_for_schedule_owner (cognitive 32) libs/agno/agno/os/middleware/jwt.py:1803 — AuthMiddleware._deny_for_schedule_owner has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 3 (5 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.queued_run_tail_streamer (cognitive 32) · ×1
  • utils.queued_run_tail_streamer (cognitive 32) libs/agno/agno/os/utils.py:410 — utils.queued_run_tail_streamer has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (8 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.get_agent_by_id (cognitive 32) · ×1
  • utils.get_agent_by_id (cognitive 32) libs/agno/agno/os/utils.py:1544 — utils.get_agent_by_id has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 5 other methods here (utils.get_agent_by_id_async, utils.get_team_by_id, utils.get_team_by_id_async, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.get_agent_by_id_async (cognitive 32) · ×1
  • utils.get_agent_by_id_async (cognitive 32) libs/agno/agno/os/utils.py:1634 — utils.get_agent_by_id_async has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 5 other methods here (utils.get_agent_by_id, utils.get_team_by_id, utils.get_team_by_id_async, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.get_team_by_id (cognitive 32) · ×1
  • utils.get_team_by_id (cognitive 32) libs/agno/agno/os/utils.py:1699 — utils.get_team_by_id has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 5 other methods here (utils.get_agent_by_id, utils.get_agent_by_id_async, utils.get_team_by_id_async, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.get_team_by_id_async (cognitive 32) · ×1
  • utils.get_team_by_id_async (cognitive 32) libs/agno/agno/os/utils.py:1779 — utils.get_team_by_id_async has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 5 other methods here (utils.get_agent_by_id, utils.get_agent_by_id_async, utils.get_team_by_id, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.get_workflow_by_id (cognitive 32) · ×1
  • utils.get_workflow_by_id (cognitive 32) libs/agno/agno/os/utils.py:1836 — utils.get_workflow_by_id has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 5 other methods here (utils.get_agent_by_id, utils.get_agent_by_id_async, utils.get_team_by_id, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.get_workflow_by_id_async (cognitive 32) · ×1
  • utils.get_workflow_by_id_async (cognitive 32) libs/agno/agno/os/utils.py:1921 — utils.get_workflow_by_id_async has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 5 other methods here (utils.get_agent_by_id, utils.get_agent_by_id_async, utils.get_team_by_id, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ScheduleExecutor._poll_run (cognitive 32) · ×1
  • ScheduleExecutor._poll_run (cognitive 32) libs/agno/agno/scheduler/executor.py:535 — ScheduleExecutor._poll_run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (10 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._build_trailing_sections (cognitive 32) · ×1
  • _messages._build_trailing_sections (cognitive 32) libs/agno/agno/team/_messages.py:346 — _messages._build_trailing_sections has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OxylabsTools.search_amazon_products (cognitive 32) · ×1
  • OxylabsTools.search_amazon_products (cognitive 32) libs/agno/agno/tools/oxylabs.py:263 — OxylabsTools.search_amazon_products has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (9 pts), boolean chains 7, error handling 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · XTools.search_posts (cognitive 32) · ×1
  • XTools.search_posts (cognitive 32) libs/agno/agno/tools/x.py:250 — XTools.search_posts has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 4 (6 pts), loops 2 (4 pts), error handling 2, boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.search (cognitive 32) · ×1
  • MongoDb.search (cognitive 32) REDACTED:639 — MongoDb.search has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2 (5 pts), error handling 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.async_insert (cognitive 32) · ×1
  • MongoDb.async_insert (cognitive 32) REDACTED:1141 — MongoDb.async_insert has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 5 (11 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenSearch._async_embed_documents (cognitive 32) · ×1
  • OpenSearch._async_embed_documents (cognitive 32) REDACTED:1440 — OpenSearch._async_embed_documents has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 2 (5 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.execute (cognitive 32) · ×1
  • Router.execute (cognitive 32) libs/agno/agno/workflow/router.py:621 — Router.execute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 3 (6 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Router.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Router.aexecute (cognitive 32) · ×1
  • Router.aexecute (cognitive 32) libs/agno/agno/workflow/router.py:952 — Router.aexecute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 3 (6 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Router.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Step._convert_image_artifacts_to_images (cognitive 32) · ×1
  • Step._convert_image_artifacts_to_images (cognitive 32) libs/agno/agno/workflow/step.py:3520 — Step._convert_image_artifacts_to_images has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (24 pts), error handling 2 (7 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Steps.execute (cognitive 32) · ×1
  • Steps.execute (cognitive 32) libs/agno/agno/workflow/steps.py:244 — Steps.execute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, error handling 3, ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Steps.aexecute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Steps.aexecute (cognitive 32) · ×1
  • Steps.aexecute (cognitive 32) libs/agno/agno/workflow/steps.py:550 — Steps.aexecute has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, error handling 3, ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Steps.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · studio_hitl_agent_os.resolve_paused_tools (cognitive 32) · ×1
  • studio_hitl_agent_os.resolve_paused_tools (cognitive 32) cookbook/05_agent_os/22_studio/studio_hitl_agent_os.py:113 — studio_hitl_agent_os.resolve_paused_tools has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (11 pts), boolean chains 6, ternaries 1 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage.resolve_memory_manager_reference (cognitive 31) · ×1
  • _storage.resolve_memory_manager_reference (cognitive 31) libs/agno/agno/agent/_storage.py:96 — _storage.resolve_memory_manager_reference has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · BaseDb.__init__ (cognitive 31) · ×1
  • BaseDb.__init__ (cognitive 31) libs/agno/agno/db/base.py:305 — BaseDb.__init__ has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 29, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · FirestoreDb.get_trace_stats (cognitive 31) · ×1
  • FirestoreDb.get_trace_stats (cognitive 31) libs/agno/agno/db/firestore/firestore.py:2453 — FirestoreDb.get_trace_stats has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.calculate_date_metrics (cognitive 31) · ×1
  • utils.calculate_date_metrics (cognitive 31) libs/agno/agno/db/firestore/utils.py:193 — utils.calculate_date_metrics has cognitive complexity 31 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (10 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v1_to_v2.get_table_content_in_batches (cognitive 31) · ×1
  • v1_to_v2.get_table_content_in_batches (cognitive 31) REDACTED:453 — v1_to_v2.get_table_content_in_batches has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._revert_surrealdb (cognitive 31) · ×1
  • v3_0_0._revert_surrealdb (cognitive 31) REDACTED:2471 — v3_0_0._revert_surrealdb has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 3 (7 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._migrate_async_postgres_user_id (cognitive 31) · ×1
  • v3_0_0._migrate_async_postgres_user_id (cognitive 31) REDACTED:3161 — v3_0_0._migrate_async_postgres_user_id has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb._get_table (cognitive 31) · ×1
  • PostgresDb._get_table (cognitive 31) libs/agno/agno/db/postgres/postgres.py:631 — PostgresDb._get_table has cognitive complexity 31 (threshold 15). Drivers by points: if/else 30 (31 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Knowledge._aupdate_content (cognitive 31) · ×1
  • Knowledge._aupdate_content (cognitive 31) libs/agno/agno/knowledge/knowledge.py:4868 — Knowledge._aupdate_content has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCoordinator.grep (cognitive 31) · ×1
  • PageCoordinator.grep (cognitive 31) REDACTED:1089 — PageCoordinator.grep has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), ternaries 1 (3 pts), boolean chains 2, error handling 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · job_queue.acontinue_via_queue (cognitive 31) · ×1
  • job_queue.acontinue_via_queue (cognitive 31) libs/agno/agno/os/job_queue.py:2583 — job_queue.acontinue_via_queue has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · utils.get_session_name (cognitive 31) · ×1
  • utils.get_session_name (cognitive 31) libs/agno/agno/os/utils.py:1004 — utils.get_session_name has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentSession.get_tool_calls (cognitive 31) · ×1
  • AgentSession.get_tool_calls (cognitive 31) libs/agno/agno/session/agent.py:276 — AgentSession.get_tool_calls has cognitive complexity 31 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 3 (12 pts), boolean chains 3 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CodingTools._check_command (cognitive 31) · ×1
  • CodingTools._check_command (cognitive 31) libs/agno/agno/tools/coding.py:317 — CodingTools._check_command has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 3 (7 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleCalendarTools.find_available_slots (cognitive 31) · ×1
  • GoogleCalendarTools.find_available_slots (cognitive 31) libs/agno/agno/tools/google/calendar.py:529 — GoogleCalendarTools.find_available_slots has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, error handling 2 (4 pts), loops 3 (4 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OxylabsTools.scrape_website (cognitive 31) · ×1
  • OxylabsTools.scrape_website (cognitive 31) libs/agno/agno/tools/oxylabs.py:354 — OxylabsTools.scrape_website has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (11 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParallelTools.parallel_extract (cognitive 31) · ×1
  • ParallelTools.parallel_extract (cognitive 31) libs/agno/agno/tools/parallel.py:227 — ParallelTools.parallel_extract has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 3, error handling 2, loops 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · gemini.has_self_reference (cognitive 31) · ×1
  • gemini.has_self_reference (cognitive 31) libs/agno/agno/utils/gemini.py:128 — gemini.has_self_reference has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 3 (9 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · claude._format_image_for_message (cognitive 31) · ×1
  • claude._format_image_for_message (cognitive 31) libs/agno/agno/utils/models/claude.py:255 — claude._format_image_for_message has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 3 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._enrich_event_with_workflow_context (cognitive 31) · ×1
  • Workflow._enrich_event_with_workflow_context (cognitive 31) libs/agno/agno/workflow/workflow.py:2680 — Workflow._enrich_event_with_workflow_context has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 7, ternaries 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.build_messages_with_history (cognitive 30) · ×1
  • utils.build_messages_with_history (cognitive 30) libs/agno/agno/agents/langgraph/utils.py:7 — utils.build_messages_with_history has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), error handling 1 (7 pts), loops 2 (7 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · v1_to_v2.convert_v1_media_to_v2 (cognitive 30) · ×1
  • v1_to_v2.convert_v1_media_to_v2 (cognitive 30) REDACTED:180 — v1_to_v2.convert_v1_media_to_v2 has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7, error handling 2 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v1_to_v2.convert_v1_fields_to_v2 (cognitive 30) · ×1
  • v1_to_v2.convert_v1_fields_to_v2 (cognitive 30) REDACTED:251 — v1_to_v2.convert_v1_fields_to_v2 has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 4, ternaries 1 (4 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncPostgresDb._cascade_tool_results (cognitive 30) · ×1
  • AsyncPostgresDb._cascade_tool_results (cognitive 30) libs/agno/agno/db/postgres/async_postgres.py:1382 — AsyncPostgresDb._cascade_tool_results has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4 (8 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncPostgresDb.upsert_knowledge_content (cognitive 30) · ×1
  • AsyncPostgresDb.upsert_knowledge_content (cognitive 30) libs/agno/agno/db/postgres/async_postgres.py:2743 — AsyncPostgresDb.upsert_knowledge_content has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb._cascade_tool_results (cognitive 30) · ×1
  • PostgresDb._cascade_tool_results (cognitive 30) libs/agno/agno/db/postgres/postgres.py:1553 — PostgresDb._cascade_tool_results has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4 (8 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.upsert_knowledge_content (cognitive 30) · ×1
  • PostgresDb.upsert_knowledge_content (cognitive 30) libs/agno/agno/db/postgres/postgres.py:3288 — PostgresDb.upsert_knowledge_content has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb.get_trace_stats (cognitive 30) · ×1
  • RedisDb.get_trace_stats (cognitive 30) libs/agno/agno/db/redis/redis.py:2215 — RedisDb.get_trace_stats has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 6, loops 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb._cascade_tool_results (cognitive 30) · ×1
  • AsyncSqliteDb._cascade_tool_results (cognitive 30) REDACTED:1307 — AsyncSqliteDb._cascade_tool_results has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4 (8 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb.get_trace_stats (cognitive 30) · ×1
  • AsyncSqliteDb.get_trace_stats (cognitive 30) REDACTED:3652 — AsyncSqliteDb.get_trace_stats has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (17 pts), error handling 3 (5 pts), ternaries 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SqliteDb._cascade_tool_results (cognitive 30) · ×1
  • SqliteDb._cascade_tool_results (cognitive 30) REDACTED:1504 — SqliteDb._cascade_tool_results has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4 (8 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.get_trace_stats (cognitive 30) · ×1
  • SqliteDb.get_trace_stats (cognitive 30) REDACTED:3851 — SqliteDb.get_trace_stats has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (17 pts), error handling 3 (5 pts), ternaries 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GitHubLoader._aload_from_github (cognitive 30) · ×1
  • GitHubLoader._aload_from_github (cognitive 30) libs/agno/agno/knowledge/loaders/github.py:336 — GitHubLoader._aload_from_github has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (GitHubLoader._load_from_github) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GitHubLoader._load_from_github (cognitive 30) · ×1
  • GitHubLoader._load_from_github (cognitive 30) libs/agno/agno/knowledge/loaders/github.py:495 — GitHubLoader._load_from_github has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (GitHubLoader._aload_from_github) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · machine.describe_learning_machine (cognitive 30) · ×1
  • machine.describe_learning_machine (cognitive 30) libs/agno/agno/learn/machine.py:1255 — machine.describe_learning_machine has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 5 (12 pts), boolean chains 4, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DecisionLogStore._filter_decisions (cognitive 30) · ×1
  • DecisionLogStore._filter_decisions (cognitive 30) libs/agno/agno/learn/stores/decision_log.py:824 — DecisionLogStore._filter_decisions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserProfileStore._get_system_message (cognitive 30) · ×1
  • UserProfileStore._get_system_message (cognitive 30) libs/agno/agno/learn/stores/user_profile.py:1030 — UserProfileStore._get_system_message has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Cohere.get_request_params (cognitive 30) · ×1
  • Cohere.get_request_params (cognitive 30) libs/agno/agno/models/cohere/chat.py:137 — Cohere.get_request_params has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenCVTools.capture_video (cognitive 30) · ×1
  • OpenCVTools.capture_video (cognitive 30) libs/agno/agno/tools/opencv.py:147 — OpenCVTools.capture_video has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools.publish_component (cognitive 30) · ×1
  • StudioTools.publish_component (cognitive 30) libs/agno/agno/tools/studio.py:3256 — StudioTools.publish_component has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 3, error handling 2, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.await_for_thread_tasks_stream (cognitive 30) · ×1
  • agent.await_for_thread_tasks_stream (cognitive 30) libs/agno/agno/utils/agent.py:87 — agent.await_for_thread_tasks_stream has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), error handling 3 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cassandra.async_insert (cognitive 30) · ×1
  • Cassandra.async_insert (cognitive 30) REDACTED:240 — Cassandra.async_insert has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, ternaries 2 (6 pts), error handling 2 (5 pts), loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChromaDb.update_metadata (cognitive 30) · ×1
  • ChromaDb.update_metadata (cognitive 30) REDACTED:1702 — ChromaDb.update_metadata has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 2 (6 pts), boolean chains 3, loops 2 (3 pts), error handling 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Elasticsearch._async_embed_documents (cognitive 30) · ×1
  • Elasticsearch._async_embed_documents (cognitive 30) REDACTED:1587 — Elasticsearch._async_embed_documents has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 2 (5 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStore.async_upsert (cognitive 30) · ×1
  • SingleStore.async_upsert (cognitive 30) REDACTED:746 — SingleStore.async_upsert has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (6 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StepInput.get_step_content (cognitive 30) · ×1
  • StepInput.get_step_content (cognitive 30) libs/agno/agno/workflow/types.py:376 — StepInput.get_step_content has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (7 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow.run_parameters (cognitive 30) · ×1
  • Workflow.run_parameters (cognitive 30) libs/agno/agno/workflow/workflow.py:873 — Workflow.run_parameters has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 5 (20 pts), if/else 4 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow._find_inner_step_by_executor (cognitive 30) · ×1
  • workflow._find_inner_step_by_executor (cognitive 30) libs/agno/agno/workflow/workflow.py:277 — workflow._find_inner_step_by_executor has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 8, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · file_search_rag_pipeline.query_with_citations (cognitive 30) · ×1
  • file_search_rag_pipeline.query_with_citations (cognitive 30) cookbook/90_models/google/gemini/file_search_rag_pipeline.py:95 — file_search_rag_pipeline.query_with_citations has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · summary._summary_report (cognitive 29) · ×1
  • summary._summary_report (cognitive 29) libs/agno/agno/company/summary.py:118 — summary._summary_report has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, ternaries 3 (6 pts), loops 3, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · filter_converter.filter_expr_to_sqlalchemy (cognitive 29) · ×1
  • filter_converter.filter_expr_to_sqlalchemy (cognitive 29) libs/agno/agno/db/filter_converter.py:63 — filter_converter.filter_expr_to_sqlalchemy has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 5 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb.get_sessions (cognitive 29) · ×1
  • FirestoreDb.get_sessions (cognitive 29) libs/agno/agno/db/firestore/firestore.py:741 — FirestoreDb.get_sessions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FirestoreDb.upsert_trace (cognitive 29) · ×1
  • FirestoreDb.upsert_trace (cognitive 29) libs/agno/agno/db/firestore/firestore.py:2217 — FirestoreDb.upsert_trace has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.upsert_trace (cognitive 29) · ×1
  • GcsJsonDb.upsert_trace (cognitive 29) libs/agno/agno/db/gcs_json/gcs_json_db.py:1595 — GcsJsonDb.upsert_trace has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.upsert_trace (cognitive 29) · ×1
  • JsonDb.upsert_trace (cognitive 29) libs/agno/agno/db/json/json_db.py:1699 — JsonDb.upsert_trace has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.calculate_date_metrics (cognitive 29) · ×1
  • utils.calculate_date_metrics (cognitive 29) libs/agno/agno/db/mongo/utils.py:140 — utils.calculate_date_metrics has cognitive complexity 29 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (10 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.set_current_version (cognitive 29) · ×1
  • PostgresDb.set_current_version (cognitive 29) libs/agno/agno/db/postgres/postgres.py:6156 — PostgresDb.set_current_version has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 2, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.set_current_version (cognitive 29) · ×1
  • SqliteDb.set_current_version (cognitive 29) REDACTED:5945 — SqliteDb.set_current_version has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 2, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AccuracyEval.arun_with_output (cognitive 29) · ×1
  • AccuracyEval.arun_with_output (cognitive 29) libs/agno/agno/eval/accuracy.py:764 — AccuracyEval.arun_with_output has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 8 (12 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FieldLabeledCSVReader.async_read (cognitive 29) · ×1
  • FieldLabeledCSVReader.async_read (cognitive 29) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:171 — FieldLabeledCSVReader.async_read has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (7 pts), boolean chains 4, ternaries 2 (3 pts), error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsBedrock.get_async_client (cognitive 29) · ×1
  • AwsBedrock.get_async_client (cognitive 29) libs/agno/agno/models/aws/bedrock.py:168 — AwsBedrock.get_async_client has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 8 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueWorker._execute_streaming (cognitive 29) · ×1
  • QueueWorker._execute_streaming (cognitive 29) libs/agno/agno/os/job_queue.py:1341 — QueueWorker._execute_streaming has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunOutput.from_dict (cognitive 29) · ×1
  • RunOutput.from_dict (cognitive 29) libs/agno/agno/run/agent.py:908 — RunOutput.from_dict has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 4 (5 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _run._requirement_decision_slots (cognitive 29) · ×1
  • _run._requirement_decision_slots (cognitive 29) libs/agno/agno/team/_run.py:5999 — _run._requirement_decision_slots has cognitive complexity 29 (threshold 15). Drivers by points: loops 7 (19 pts), if/else 2 (6 pts), boolean chains 4 (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · FileGenerationTools.generate_csv_file (cognitive 29) · ×1
  • FileGenerationTools.generate_csv_file (cognitive 29) libs/agno/agno/tools/file/generation.py:258 — FileGenerationTools.generate_csv_file has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (7 pts), boolean chains 1, error handling 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · FunctionCall._build_entrypoint_args (cognitive 29) · ×1
  • FunctionCall._build_entrypoint_args (cognitive 29) libs/agno/agno/tools/function.py:2266 — FunctionCall._build_entrypoint_args has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SalesforceTools.__init__ (cognitive 29) · ×1
  • SalesforceTools.__init__ (cognitive 29) libs/agno/agno/tools/salesforce.py:50 — SalesforceTools.__init__ has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 17, if/else 11, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · StudioTools._step_config_to_spec (cognitive 29) · ×1
  • StudioTools._step_config_to_spec (cognitive 29) libs/agno/agno/tools/studio.py:1612 — StudioTools._step_config_to_spec has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, loops 3, ternaries 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools.update_schedule (cognitive 29) · ×1
  • StudioTools.update_schedule (cognitive 29) libs/agno/agno/tools/studio.py:4620 — StudioTools.update_schedule has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6, ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LanceDb.update_metadata (cognitive 29) · ×1
  • LanceDb.update_metadata (cognitive 29) REDACTED:1127 — LanceDb.update_metadata has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 3 (5 pts), loops 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb._search_index_exists (cognitive 29) · ×1
  • MongoDb._search_index_exists (cognitive 29) REDACTED:405 — MongoDb._search_index_exists has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (6 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PgVector._async_embed_documents (cognitive 29) · ×1
  • PgVector._async_embed_documents (cognitive 29) REDACTED:718 — PgVector._async_embed_documents has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 2 (5 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Step._execute_nested_workflow_stream_inner (cognitive 29) · ×1
  • Step._execute_nested_workflow_stream_inner (cognitive 29) libs/agno/agno/workflow/step.py:3023 — Step._execute_nested_workflow_stream_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 7, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (Step._aexecute_nested_workflow_stream_inner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Step._aexecute_nested_workflow_stream_inner (cognitive 29) · ×1
  • Step._aexecute_nested_workflow_stream_inner (cognitive 29) libs/agno/agno/workflow/step.py:3301 — Step._aexecute_nested_workflow_stream_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 7, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (Step._execute_nested_workflow_stream_inner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Workflow.arun (cognitive 29) · ×1
  • Workflow.arun (cognitive 29) libs/agno/agno/workflow/workflow.py:10801 — Workflow.arun has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 11, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · index.html.imageSearch.runSearch (cognitive 29) · ×1
  • index.html.imageSearch.runSearch (cognitive 29) cookbook/data_labeling/image_search/public/index.html:333 — index.html.imageSearch.runSearch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 9, error handling 1 (nesting depth added 4). Of this number, 26 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · BaseExternalAgent._arun_non_stream (cognitive 28) · ×1
  • BaseExternalAgent._arun_non_stream (cognitive 28) libs/agno/agno/agents/base.py:1772 — BaseExternalAgent._arun_non_stream has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), ternaries 7, error handling 4 (6 pts), loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · sources._local_files (cognitive 28) · ×1
  • sources._local_files (cognitive 28) libs/agno/agno/company/sources.py:19 — sources._local_files has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 7, ternaries 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_traces (cognitive 28) · ×1
  • DynamoDb.get_traces (cognitive 28) libs/agno/agno/db/dynamo/dynamo.py:2690 — DynamoDb.get_traces has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 3 (5 pts), boolean chains 3, ternaries 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb._get_all_sessions_for_metrics_calculation (cognitive 28) · ×1
  • FirestoreDb._get_all_sessions_for_metrics_calculation (cognitive 28) libs/agno/agno/db/firestore/firestore.py:1543 — FirestoreDb._get_all_sessions_for_metrics_calculation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (8 pts), boolean chains 4, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMongoDb.get_sessions (cognitive 28) · ×1
  • AsyncMongoDb.get_sessions (cognitive 28) libs/agno/agno/db/mongo/async_mongo.py:969 — AsyncMongoDb.get_sessions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MongoDb.get_sessions (cognitive 28) · ×1
  • MongoDb.get_sessions (cognitive 28) libs/agno/agno/db/mongo/mongo.py:779 — MongoDb.get_sessions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncPostgresDb.get_sessions (cognitive 28) · ×1
  • AsyncPostgresDb.get_sessions (cognitive 28) libs/agno/agno/db/postgres/async_postgres.py:1612 — AsyncPostgresDb.get_sessions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (6 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncPostgresDb.get_span_stats (cognitive 28) · ×1
  • AsyncPostgresDb.get_span_stats (cognitive 28) libs/agno/agno/db/postgres/async_postgres.py:3827 — AsyncPostgresDb.get_span_stats has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 5 (8 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.get_span_stats (cognitive 28) · ×1
  • PostgresDb.get_span_stats (cognitive 28) libs/agno/agno/db/postgres/postgres.py:4366 — PostgresDb.get_span_stats has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 5 (8 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SurrealDb.get_sessions (cognitive 28) · ×1
  • SurrealDb.get_sessions (cognitive 28) libs/agno/agno/db/surrealdb/surrealdb.py:630 — SurrealDb.get_sessions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (24 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mdx._esm_end (cognitive 28) · ×1
  • mdx._esm_end (cognitive 28) libs/agno/agno/knowledge/reader/utils/mdx.py:257 — mdx._esm_end has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (21 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionContextStore.print (cognitive 28) · ×1
  • SessionContextStore.print (cognitive 28) libs/agno/agno/learn/stores/session_context.py:1189 — SessionContextStore.print has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChat._format_message (cognitive 28) · ×1
  • OpenAIChat._format_message (cognitive 28) libs/agno/agno/models/openai/chat.py:314 — OpenAIChat._format_message has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp_results.build_custom_tool_result (cognitive 28) · ×1
  • mcp_results.build_custom_tool_result (cognitive 28) libs/agno/agno/os/mcp_results.py:148 — mcp_results.build_custom_tool_result has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 9, loops 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sandbox.sandbox_run_response (cognitive 28) · ×1
  • sandbox.sandbox_run_response (cognitive 28) libs/agno/agno/os/routers/agents/sandbox.py:121 — sandbox.sandbox_run_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, error handling 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.workflow_response_streamer (cognitive 28) · ×1
  • router.workflow_response_streamer (cognitive 28) libs/agno/agno/os/routers/workflows/router.py:1167 — router.workflow_response_streamer has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5, ternaries 1 (3 pts), error handling 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils._collect_components_from_step (cognitive 28) · ×1
  • utils._collect_components_from_step (cognitive 28) libs/agno/agno/os/utils.py:2562 — utils._collect_components_from_step has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScheduleExecutor._call_endpoint (cognitive 28) · ×1
  • ScheduleExecutor._call_endpoint (cognitive 28) libs/agno/agno/scheduler/executor.py:331 — ScheduleExecutor._call_endpoint has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedmineTools.__init__ (cognitive 28) · ×1
  • RedmineTools.__init__ (cognitive 28) libs/agno/agno/tools/redmine.py:15 — RedmineTools.__init__ has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 15, if/else 13. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · RedshiftTools._get_connection_kwargs (cognitive 28) · ×1
  • RedshiftTools._get_connection_kwargs (cognitive 28) libs/agno/agno/tools/redshift.py:153 — RedshiftTools._get_connection_kwargs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (28 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShopifyTools.get_product_sales_breakdown (cognitive 28) · ×1
  • ShopifyTools.get_product_sales_breakdown (cognitive 28) libs/agno/agno/tools/shopify.py:776 — ShopifyTools.get_product_sales_breakdown has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools.list_components (cognitive 28) · ×1
  • StudioTools.list_components (cognitive 28) libs/agno/agno/tools/studio.py:1900 — StudioTools.list_components has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VisualizationTools._normalize_data_for_charts (cognitive 28) · ×1
  • VisualizationTools._normalize_data_for_charts (cognitive 28) libs/agno/agno/tools/visualization.py:56 — VisualizationTools._normalize_data_for_charts has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 3 (11 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · functions.get_function_call (cognitive 28) · ×1
  • functions.get_function_call (cognitive 28) REDACTED:10 — functions.get_function_call has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 3 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CouchbaseSearch.upsert (cognitive 28) · ×1
  • CouchbaseSearch.upsert (cognitive 28) REDACTED:446 — CouchbaseSearch.upsert has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 3 (6 pts), ternaries 1 (3 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LanceDb.search (cognitive 28) · ×1
  • LanceDb.search (cognitive 28) REDACTED:597 — LanceDb.search has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UpstashVectorDb.upsert (cognitive 28) · ×1
  • UpstashVectorDb.upsert (cognitive 28) REDACTED:302 — UpstashVectorDb.upsert has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.update_agents_and_teams_session_info (cognitive 28) · ×1
  • Workflow.update_agents_and_teams_session_info (cognitive 28) libs/agno/agno/workflow/workflow.py:11430 — Workflow.update_agents_and_teams_session_info has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 2 (7 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · disconnect._report (cognitive 28) · ×1
  • disconnect._report (cognitive 28) libs/agnoctl/agnoctl/commands/disconnect.py:247 — disconnect._report has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, loops 3 (5 pts), ternaries 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · automation_history._record_task_failures (cognitive 27) · ×1
  • automation_history._record_task_failures (cognitive 27) libs/agno/agno/company/automation_history.py:31 — automation_history._record_task_failures has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 pts), boolean chains 5, error handling 1 (2 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · notion_ops.markdown_to_blocks (cognitive 27) · ×1
  • notion_ops.markdown_to_blocks (cognitive 27) libs/agno/agno/context/wiki/notion_ops.py:268 — notion_ops.markdown_to_blocks has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_runs (cognitive 27) · ×1
  • DynamoDb.get_runs (cognitive 27) libs/agno/agno/db/dynamo/dynamo.py:449 — DynamoDb.get_runs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (21 pts), error handling 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.upsert_trace (cognitive 27) · ×1
  • DynamoDb.upsert_trace (cognitive 27) libs/agno/agno/db/dynamo/dynamo.py:2511 — DynamoDb.upsert_trace has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 6, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_spans (cognitive 27) · ×1
  • DynamoDb.get_spans (cognitive 27) libs/agno/agno/db/dynamo/dynamo.py:3135 — DynamoDb.get_spans has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, loops 4 (7 pts), error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.get_runs (cognitive 27) · ×1
  • GcsJsonDb.get_runs (cognitive 27) libs/agno/agno/db/gcs_json/gcs_json_db.py:324 — GcsJsonDb.get_runs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_runs (cognitive 27) · ×1
  • JsonDb.get_runs (cognitive 27) libs/agno/agno/db/json/json_db.py:360 — JsonDb.get_runs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (24 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._migrate_dynamodb (cognitive 27) · ×1
  • v3_0_0._migrate_dynamodb (cognitive 27) REDACTED:2253 — v3_0_0._migrate_dynamodb has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb.get_sessions (cognitive 27) · ×1
  • AsyncSqliteDb.get_sessions (cognitive 27) REDACTED:1542 — AsyncSqliteDb.get_sessions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SqliteDb.get_sessions (cognitive 27) · ×1
  • SqliteDb.get_sessions (cognitive 27) REDACTED:1799 — SqliteDb.get_sessions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · suite.arun_cases (cognitive 27) · ×1
  • suite.arun_cases (cognitive 27) libs/agno/agno/eval/suite.py:560 — suite.arun_cases has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (9 pts), ternaries 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownChunking.chunk (cognitive 27) · ×1
  • MarkdownChunking.chunk (cognitive 27) libs/agno/agno/knowledge/chunking/markdown.py:238 — MarkdownChunking.chunk has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CohereEmbedder.async_get_embeddings_batch_and_usage (cognitive 27) · ×1
  • CohereEmbedder.async_get_embeddings_batch_and_usage (cognitive 27) libs/agno/agno/knowledge/embedder/cohere.py:267 — CohereEmbedder.async_get_embeddings_batch_and_usage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 2 (8 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge._update_content (cognitive 27) · ×1
  • Knowledge._update_content (cognitive 27) libs/agno/agno/knowledge/knowledge.py:4808 — Knowledge._update_content has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._extract_step_result (cognitive 27) · ×1
  • GeminiInteractions._extract_step_result (cognitive 27) libs/agno/agno/models/google/gemini_interactions.py:690 — GeminiInteractions._extract_step_result has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · OpenAIResponses.invoke (cognitive 27) · ×1
  • OpenAIResponses.invoke (cognitive 27) libs/agno/agno/models/openai/responses.py:864 — OpenAIResponses.invoke has cognitive complexity 27 (threshold 15). Drivers by points: error handling 8 (10 pts), if/else 6 (8 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIResponses.ainvoke) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · OpenAIResponses.ainvoke (cognitive 27) · ×1
  • OpenAIResponses.ainvoke (cognitive 27) libs/agno/agno/models/openai/responses.py:985 — OpenAIResponses.ainvoke has cognitive complexity 27 (threshold 15). Drivers by points: error handling 8 (10 pts), if/else 6 (8 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIResponses.invoke) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.map_a2a_request_to_run_input (cognitive 27) · ×1
  • utils.map_a2a_request_to_run_input (cognitive 27) libs/agno/agno/os/interfaces/a2a/utils.py:86 — utils.map_a2a_request_to_run_input has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 5, error handling 2 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp._mcp_hidden_params (cognitive 27) · ×1
  • mcp._mcp_hidden_params (cognitive 27) libs/agno/agno/os/mcp.py:332 — mcp._mcp_hidden_params has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 3 (4 pts), loops 3 (4 pts), boolean chains 2, ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · knowledge.process_content (cognitive 27) · ×1
  • knowledge.process_content (cognitive 27) libs/agno/agno/os/routers/knowledge/knowledge.py:1724 — knowledge.process_content has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 3 (7 pts), boolean chains 3, loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openai.get_openai_reasoning_stream (cognitive 27) · ×1
  • openai.get_openai_reasoning_stream (cognitive 27) libs/agno/agno/reasoning/openai.py:120 — openai.get_openai_reasoning_stream has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 3, loops 2, error handling 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (openai.aget_openai_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · openai.aget_openai_reasoning_stream (cognitive 27) · ×1
  • openai.aget_openai_reasoning_stream (cognitive 27) libs/agno/agno/reasoning/openai.py:176 — openai.aget_openai_reasoning_stream has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 3, loops 2, error handling 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (openai.get_openai_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _session.asave_session (cognitive 27) · ×1
  • _session.asave_session (cognitive 27) libs/agno/agno/team/_session.py:386 — _session.asave_session has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (4 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CartesiaTools.list_voices (cognitive 27) · ×1
  • CartesiaTools.list_voices (cognitive 27) libs/agno/agno/tools/cartesia.py:50 — CartesiaTools.list_voices has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (13 pts), error handling 3 (7 pts), if/else 3 (5 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileGenerationTools.__init__ (cognitive 27) · ×1
  • FileGenerationTools.__init__ (cognitive 27) libs/agno/agno/tools/file/generation.py:96 — FileGenerationTools.__init__ has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 14, if/else 11, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · GoogleCalendarTools.fetch_all_events (cognitive 27) · ×1
  • GoogleCalendarTools.fetch_all_events (cognitive 27) libs/agno/agno/tools/google/calendar.py:453 — GoogleCalendarTools.fetch_all_events has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 3 (7 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._bind_child_to_target_db (cognitive 27) · ×1
  • StudioTools._bind_child_to_target_db (cognitive 27) libs/agno/agno/tools/studio.py:4853 — StudioTools._bind_child_to_target_db has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 7 (8 pts), boolean chains 6, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Toolkit._register_decorated_tool (cognitive 27) · ×1
  • Toolkit._register_decorated_tool (cognitive 27) libs/agno/agno/tools/toolkit.py:328 — Toolkit._register_decorated_tool has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, ternaries 3, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · agent.scrub_media_from_message (cognitive 27) · ×1
  • agent.scrub_media_from_message (cognitive 27) libs/agno/agno/utils/agent.py:509 — agent.scrub_media_from_message has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 11 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · message.filter_tool_calls (cognitive 27) · ×1
  • message.filter_tool_calls (cognitive 27) libs/agno/agno/utils/message.py:110 — message.filter_tool_calls has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · llama.format_message (cognitive 27) · ×1
  • llama.format_message (cognitive 27) libs/agno/agno/utils/models/llama.py:22 — llama.format_message has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · string._parse_individual_json (cognitive 27) · ×1
  • string._parse_individual_json (cognitive 27) libs/agno/agno/utils/string.py:155 — string._parse_individual_json has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (4 pts), error handling 2 (3 pts), ternaries 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PgVector._async_upsert (cognitive 27) · ×1
  • PgVector._async_upsert (cognitive 27) REDACTED:801 — PgVector._async_upsert has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 3 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStore.async_insert (cognitive 27) · ×1
  • SingleStore.async_insert (cognitive 27) REDACTED:664 — SingleStore.async_insert has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (6 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrate_sentinel_vectordbs.migrate_couchbase (cognitive 27) · ×1
  • migrate_sentinel_vectordbs.migrate_couchbase (cognitive 27) libs/agno/migrations/v2_to_v3/migrate_sentinel_vectordbs.py:174 — migrate_sentinel_vectordbs.migrate_couchbase has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 3, boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmrCluster._create (cognitive 27) · ×1
  • EmrCluster._create (cognitive 27) libs/agno_infra/agno/aws/resource/emr/cluster.py:87 — EmrCluster._create has cognitive complexity 27 (threshold 15). Drivers by points: if/else 26, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · run_all.print_agno_vs_table (cognitive 27) · ×1
  • run_all.print_agno_vs_table (cognitive 27) cookbook/performance/comparison/run_all.py:62 — run_all.print_agno_vs_table has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (8 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _default_tools._extract_session_preview (cognitive 26) · ×1
  • _default_tools._extract_session_preview (cognitive 26) libs/agno/agno/agent/_default_tools.py:443 — _default_tools._extract_session_preview has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _managers.make_memories (cognitive 26) · ×1
  • _managers.make_memories (cognitive 26) libs/agno/agno/agent/_managers.py:29 — _managers.make_memories has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, error handling 1 (4 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_managers.amake_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _managers.amake_memories (cognitive 26) · ×1
  • _managers.amake_memories (cognitive 26) libs/agno/agno/agent/_managers.py:84 — _managers.amake_memories has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, error handling 1 (4 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_managers.make_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._handle_run_cancellation (cognitive 26) · ×1
  • _run._handle_run_cancellation (cognitive 26) libs/agno/agno/agent/_run.py:5895 — _run._handle_run_cancellation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools.ahandle_tool_call_updates (cognitive 26) · ×1
  • _tools.ahandle_tool_call_updates (cognitive 26) libs/agno/agno/agent/_tools.py:1178 — _tools.ahandle_tool_call_updates has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 8, loops 3 (8 pts), if/else 4 (7 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_tools.ahandle_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _tools.ahandle_tool_call_updates_stream (cognitive 26) · ×1
  • _tools.ahandle_tool_call_updates_stream (cognitive 26) libs/agno/agno/agent/_tools.py:1234 — _tools.ahandle_tool_call_updates_stream has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 8, loops 3 (8 pts), if/else 4 (7 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_tools.ahandle_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · agent.get_agents (cognitive 26) · ×1
  • agent.get_agents (cognitive 26) libs/agno/agno/agent/agent.py:1953 — agent.get_agents has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (4 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb._get_collection (cognitive 26) · ×1
  • FirestoreDb._get_collection (cognitive 26) libs/agno/agno/db/firestore/firestore.py:126 — FirestoreDb._get_collection has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (26 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._migrate_postgres_user_id (cognitive 26) · ×1
  • v3_0_0._migrate_postgres_user_id (cognitive 26) REDACTED:3068 — v3_0_0._migrate_postgres_user_id has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._migrate_mysql_like_user_id (cognitive 26) · ×1
  • v3_0_0._migrate_mysql_like_user_id (cognitive 26) REDACTED:3334 — v3_0_0._migrate_mysql_like_user_id has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._migrate_async_mysql_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · v3_0_0._migrate_async_mysql_user_id (cognitive 26) · ×1
  • v3_0_0._migrate_async_mysql_user_id (cognitive 26) REDACTED:3410 — v3_0_0._migrate_async_mysql_user_id has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._migrate_mysql_like_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsyncMySQLDb.get_eval_runs (cognitive 26) · ×1
  • AsyncMySQLDb.get_eval_runs (cognitive 26) libs/agno/agno/db/mysql/async_mysql.py:2606 — AsyncMySQLDb.get_eval_runs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 3 (6 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncPostgresDb._get_table (cognitive 26) · ×1
  • AsyncPostgresDb._get_table (cognitive 26) libs/agno/agno/db/postgres/async_postgres.py:503 — AsyncPostgresDb._get_table has cognitive complexity 26 (threshold 15). Drivers by points: if/else 25 (26 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncPostgresDb.get_eval_runs (cognitive 26) · ×1
  • AsyncPostgresDb.get_eval_runs (cognitive 26) libs/agno/agno/db/postgres/async_postgres.py:2978 — AsyncPostgresDb.get_eval_runs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 3 (6 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PostgresDb.get_sessions (cognitive 26) · ×1
  • PostgresDb.get_sessions (cognitive 26) libs/agno/agno/db/postgres/postgres.py:1843 — PostgresDb.get_sessions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RedisDb.upsert_trace (cognitive 26) · ×1
  • RedisDb.upsert_trace (cognitive 26) libs/agno/agno/db/redis/redis.py:1965 — RedisDb.upsert_trace has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStoreDb.get_sessions (cognitive 26) · ×1
  • SingleStoreDb.get_sessions (cognitive 26) libs/agno/agno/db/singlestore/singlestore.py:1080 — SingleStoreDb.get_sessions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncSqliteDb.get_span_stats (cognitive 26) · ×1
  • AsyncSqliteDb.get_span_stats (cognitive 26) REDACTED:3958 — AsyncSqliteDb.get_span_stats has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 4 (6 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.get_span_stats (cognitive 26) · ×1
  • SqliteDb.get_span_stats (cognitive 26) REDACTED:4152 — SqliteDb.get_span_stats has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 4 (6 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.delete_sessions (cognitive 26) · ×1
  • ValkeyDb.delete_sessions (cognitive 26) libs/agno/agno/db/valkey/valkey.py:720 — ValkeyDb.delete_sessions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (6 pts), loops 4 (5 pts), boolean chains 3, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.upsert_trace (cognitive 26) · ×1
  • ValkeyDb.upsert_trace (cognitive 26) libs/agno/agno/db/valkey/valkey.py:2399 — ValkeyDb.upsert_trace has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CohereEmbedder._async_batch_with_retry (cognitive 26) · ×1
  • CohereEmbedder._async_batch_with_retry (cognitive 26) libs/agno/agno/knowledge/embedder/cohere.py:122 — CohereEmbedder._async_batch_with_retry has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (7 pts), error handling 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DoclingReader.read (cognitive 26) · ×1
  • DoclingReader.read (cognitive 26) libs/agno/agno/knowledge/reader/docling_reader.py:223 — DoclingReader.read has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, error handling 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DeepSeek._format_message (cognitive 26) · ×1
  • DeepSeek._format_message (cognitive 26) libs/agno/agno/models/deepseek/deepseek.py:141 — DeepSeek._format_message has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._append_result_delta (cognitive 26) · ×1
  • GeminiInteractions._append_result_delta (cognitive 26) libs/agno/agno/models/google/gemini_interactions.py:744 — GeminiInteractions._append_result_delta has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LiteLLM._get_metrics (cognitive 26) · ×1
  • LiteLLM._get_metrics (cognitive 26) libs/agno/agno/models/litellm/chat.py:521 — LiteLLM._get_metrics has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 16, if/else 6 (10 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · OpenAIChat.get_request_params (cognitive 26) · ×1
  • OpenAIChat.get_request_params (cognitive 26) libs/agno/agno/models/openai/chat.py:188 — OpenAIChat.get_request_params has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS.serve (cognitive 26) · ×1
  • AgentOS.serve (cognitive 26) libs/agno/agno/os/app.py:3242 — AgentOS.serve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (11 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TraceNode.from_span (cognitive 26) · ×1
  • TraceNode.from_span (cognitive 26) libs/agno/agno/os/routers/traces/schemas.py:69 — TraceNode.from_span has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TraceDetail.from_trace_and_spans (cognitive 26) · ×1
  • TraceDetail.from_trace_and_spans (cognitive 26) libs/agno/agno/os/routers/traces/schemas.py:223 — TraceDetail.from_trace_and_spans has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.resolve_agent (cognitive 26) · ×1
  • utils.resolve_agent (cognitive 26) libs/agno/agno/os/utils.py:2956 — utils.resolve_agent has cognitive complexity 26 (threshold 15). Drivers by points: error handling 7 (14 pts), if/else 7 (8 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamRunOutput.from_dict (cognitive 26) · ×1
  • TeamRunOutput.from_dict (cognitive 26) libs/agno/agno/run/team.py:978 — TeamRunOutput.from_dict has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 4 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _run._build_continue_run_messages (cognitive 26) · ×1
  • _run._build_continue_run_messages (cognitive 26) libs/agno/agno/team/_run.py:5272 — _run._build_continue_run_messages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 3 (6 pts), loops 3, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._route_requirements_to_members (cognitive 26) · ×1
  • _run._route_requirements_to_members (cognitive 26) libs/agno/agno/team/_run.py:6394 — _run._route_requirements_to_members has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._prepare_member_hitl_continuation (cognitive 26) · ×1
  • _run._prepare_member_hitl_continuation (cognitive 26) libs/agno/agno/team/_run.py:6788 — _run._prepare_member_hitl_continuation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run.acontinue_run_dispatch (cognitive 26) · ×1
  • _run.acontinue_run_dispatch (cognitive 26) libs/agno/agno/team/_run.py:9127 — _run.acontinue_run_dispatch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 7, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · team.get_teams (cognitive 26) · ×1
  • team.get_teams (cognitive 26) libs/agno/agno/team/team.py:1995 — team.get_teams has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (4 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleSheetsTools.__init__ (cognitive 26) · ×1
  • GoogleSheetsTools.__init__ (cognitive 26) libs/agno/agno/tools/google/sheets.py:76 — GoogleSheetsTools.__init__ has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, ternaries 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SlackTools._build_instructions (cognitive 26) · ×1
  • SlackTools._build_instructions (cognitive 26) libs/agno/agno/tools/slack.py:40 — SlackTools._build_instructions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StudioTools._buildable_tool (cognitive 26) · ×1
  • StudioTools._buildable_tool (cognitive 26) libs/agno/agno/tools/studio.py:1235 — StudioTools._buildable_tool has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools.archive_component (cognitive 26) · ×1
  • StudioTools.archive_component (cognitive 26) libs/agno/agno/tools/studio.py:3523 — StudioTools.archive_component has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._resolve_members (cognitive 26) · ×1
  • StudioTools._resolve_members (cognitive 26) libs/agno/agno/tools/studio.py:5043 — StudioTools._resolve_members has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 7, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hooks.normalize_pre_hooks (cognitive 26) · ×1
  • hooks.normalize_pre_hooks (cognitive 26) libs/agno/agno/utils/hooks.py:76 — hooks.normalize_pre_hooks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (hooks.normalize_post_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · hooks.normalize_post_hooks (cognitive 26) · ×1
  • hooks.normalize_post_hooks (cognitive 26) libs/agno/agno/utils/hooks.py:119 — hooks.normalize_post_hooks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (hooks.normalize_pre_hooks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · media_offload._offload_single_media (cognitive 26) · ×1
  • media_offload._offload_single_media (cognitive 26) libs/agno/agno/utils/media_offload.py:180 — media_offload._offload_single_media has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (media_offload._aoffload_single_media) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · media_offload._aoffload_single_media (cognitive 26) · ×1
  • media_offload._aoffload_single_media (cognitive 26) libs/agno/agno/utils/media_offload.py:392 — media_offload._aoffload_single_media has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (media_offload._offload_single_media) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · string.parse_response_dict_str (cognitive 26) · ×1
  • string.parse_response_dict_str (cognitive 26) libs/agno/agno/utils/string.py:252 — string.parse_response_dict_str has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 4 (9 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Clickhouse.async_insert (cognitive 26) · ×1
  • Clickhouse.async_insert (cognitive 26) REDACTED:395 — Clickhouse.async_insert has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (5 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UpstashVectorDb.update_metadata (cognitive 26) · ×1
  • UpstashVectorDb.update_metadata (cognitive 26) REDACTED:804 — UpstashVectorDb.update_metadata has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, loops 3 (4 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._route_executor_requirements_stream (cognitive 26) · ×1
  • Workflow._route_executor_requirements_stream (cognitive 26) libs/agno/agno/workflow/workflow.py:7566 — Workflow._route_executor_requirements_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Workflow._aroute_executor_requirements_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Workflow._aroute_executor_requirements_stream (cognitive 26) · ×1
  • Workflow._aroute_executor_requirements_stream (cognitive 26) libs/agno/agno/workflow/workflow.py:7655 — Workflow._aroute_executor_requirements_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Workflow._route_executor_requirements_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · workflow.get_workflows (cognitive 26) · ×1
  • workflow.get_workflows (cognitive 26) libs/agno/agno/workflow/workflow.py:12026 — workflow.get_workflows has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (4 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EcsTaskDefinition._create (cognitive 26) · ×1
  • EcsTaskDefinition._create (cognitive 26) libs/agno_infra/agno/aws/resource/ecs/task_definition.py:95 — EcsTaskDefinition._create has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, error handling 3 (5 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · discovery._read_env_value (cognitive 26) · ×1
  • discovery._read_env_value (cognitive 26) libs/agnoctl/agnoctl/discovery.py:127 — discovery._read_env_value has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 2 (4 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOSAPI._iter_service_account_pages (cognitive 26) · ×1
  • AgentOSAPI._iter_service_account_pages (cognitive 26) libs/agnoctl/agnoctl/http.py:209 — AgentOSAPI._iter_service_account_pages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 3 (6 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 02_tool_error_persistence.scenario_b_model_call_fails (cognitive 26) · ×1
  • 02_tool_error_persistence.scenario_b_model_call_fails (cognitive 26) cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:95 — 02_tool_error_persistence.scenario_b_model_call_fails has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts), loops 2 (4 pts), ternaries 1 (4 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.get_user_memories (cognitive 25) · ×1
  • GcsJsonDb.get_user_memories (cognitive 25) libs/agno/agno/db/gcs_json/gcs_json_db.py:901 — GcsJsonDb.get_user_memories has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.get_user_memories (cognitive 25) · ×1
  • InMemoryDb.get_user_memories (cognitive 25) libs/agno/agno/db/in_memory/in_memory_db.py:743 — InMemoryDb.get_user_memories has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_user_memories (cognitive 25) · ×1
  • JsonDb.get_user_memories (cognitive 25) libs/agno/agno/db/json/json_db.py:968 — JsonDb.get_user_memories has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMySQLDb.get_sessions (cognitive 25) · ×1
  • AsyncMySQLDb.get_sessions (cognitive 25) libs/agno/agno/db/mysql/async_mysql.py:1032 — AsyncMySQLDb.get_sessions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MySQLDb.get_sessions (cognitive 25) · ×1
  • MySQLDb.get_sessions (cognitive 25) libs/agno/agno/db/mysql/mysql.py:1025 — MySQLDb.get_sessions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PostgresDb._validate_links_in_session (cognitive 25) · ×1
  • PostgresDb._validate_links_in_session (cognitive 25) libs/agno/agno/db/postgres/postgres.py:6499 — PostgresDb._validate_links_in_session has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb._validate_links_in_session (cognitive 25) · ×1
  • SqliteDb._validate_links_in_session (cognitive 25) REDACTED:6283 — SqliteDb._validate_links_in_session has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.delete_user_memories (cognitive 25) · ×1
  • ValkeyDb.delete_user_memories (cognitive 25) libs/agno/agno/db/valkey/valkey.py:1306 — ValkeyDb.delete_user_memories has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (6 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.get_metrics (cognitive 25) · ×1
  • ValkeyDb.get_metrics (cognitive 25) libs/agno/agno/db/valkey/valkey.py:1882 — ValkeyDb.get_metrics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileSystemKnowledge._grep (cognitive 25) · ×1
  • FileSystemKnowledge._grep (cognitive 25) libs/agno/agno/knowledge/filesystem.py:168 — FileSystemKnowledge._grep has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (7 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · S3Loader._aload_from_s3 (cognitive 25) · ×1
  • S3Loader._aload_from_s3 (cognitive 25) libs/agno/agno/knowledge/loaders/s3.py:67 — S3Loader._aload_from_s3 has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4 (7 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _commands._cmd_tree (cognitive 25) · ×1
  • _commands._cmd_tree (cognitive 25) libs/agno/agno/knowledge/page/_commands.py:225 — _commands._cmd_tree has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 3 (6 pts), loops 3 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCoordinator._search_queries (cognitive 25) · ×1
  • PageCoordinator._search_queries (cognitive 25) REDACTED:1289 — PageCoordinator._search_queries has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 3 (7 pts), error handling 2 (5 pts), loops 4 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions._call_step_info (cognitive 25) · ×1
  • GeminiInteractions._call_step_info (cognitive 25) libs/agno/agno/models/google/gemini_interactions.py:659 — GeminiInteractions._call_step_info has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 9 (11 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChat.parse_tool_calls (cognitive 25) · ×1
  • OpenAIChat.parse_tool_calls (cognitive 25) libs/agno/agno/models/openai/chat.py:750 — OpenAIChat.parse_tool_calls has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp.get_mcp_server (cognitive 25) · ×1
  • mcp.get_mcp_server (cognitive 25) libs/agno/agno/os/mcp.py:3293 — mcp.get_mcp_server has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 7, loops 1 (2 pts), ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · components._resolve_member_links (cognitive 25) · ×1
  • components._resolve_member_links (cognitive 25) libs/agno/agno/os/routers/components/components.py:481 — components._resolve_member_links has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · status_persist.apersist_run_transition (cognitive 25) · ×1
  • status_persist.apersist_run_transition (cognitive 25) libs/agno/agno/run/status_persist.py:125 — status_persist.apersist_run_transition has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamSession.get_tool_calls (cognitive 25) · ×1
  • TeamSession.get_tool_calls (cognitive 25) libs/agno/agno/session/team.py:289 — TeamSession.get_tool_calls has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._acontinue_run_background_stream (cognitive 25) · ×1
  • _run._acontinue_run_background_stream (cognitive 25) libs/agno/agno/team/_run.py:8659 — _run._acontinue_run_background_stream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, ternaries 3, error handling 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _session.save_session (cognitive 25) · ×1
  • _session.save_session (cognitive 25) libs/agno/agno/team/_session.py:336 — _session.save_session has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (4 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · bridge._stub_doc (cognitive 25) · ×1
  • bridge._stub_doc (cognitive 25) libs/agno/agno/tools/code/bridge.py:258 — bridge._stub_doc has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4 (9 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleSlidesTools.add_slide (cognitive 25) · ×1
  • GoogleSlidesTools.add_slide (cognitive 25) libs/agno/agno/tools/google/slides.py:377 — GoogleSlidesTools.add_slide has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._edit_component (cognitive 25) · ×1
  • StudioTools._edit_component (cognitive 25) libs/agno/agno/tools/studio.py:2836 — StudioTools._edit_component has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 7 (9 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StudioRunnerTools._require_faithful_rebuild (cognitive 25) · ×1
  • StudioRunnerTools._require_faithful_rebuild (cognitive 25) libs/agno/agno/tools/studio_runner.py:1209 — StudioRunnerTools._require_faithful_rebuild has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.wait_for_thread_tasks_stream (cognitive 25) · ×1
  • agent.wait_for_thread_tasks_stream (cognitive 25) libs/agno/agno/utils/agent.py:152 — agent.wait_for_thread_tasks_stream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 3 (8 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · callables._close_cached_resources_sync (cognitive 25) · ×1
  • callables._close_cached_resources_sync (cognitive 25) libs/agno/agno/utils/callables.py:519 — callables._close_cached_resources_sync has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 3 (6 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · media.reconstruct_file_from_dict (cognitive 25) · ×1
  • media.reconstruct_file_from_dict (cognitive 25) libs/agno/agno/utils/media.py:414 — media.reconstruct_file_from_dict has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 3, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openai_responses.sanitize_response_schema (cognitive 25) · ×1
  • openai_responses.sanitize_response_schema (cognitive 25) libs/agno/agno/utils/models/openai_responses.py:103 — openai_responses.sanitize_response_schema has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CouchbaseSearch.insert (cognitive 25) · ×1
  • CouchbaseSearch.insert (cognitive 25) REDACTED:338 — CouchbaseSearch.insert has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 2 (4 pts), ternaries 1 (3 pts), loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.async_upsert (cognitive 25) · ×1
  • MongoDb.async_upsert (cognitive 25) REDACTED:1215 — MongoDb.async_upsert has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (7 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Step._store_executor_response (cognitive 25) · ×1
  • Step._store_executor_response (cognitive 25) libs/agno/agno/workflow/step.py:2594 — Step._store_executor_response has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TargetGroup._create (cognitive 25) · ×1
  • TargetGroup._create (cognitive 25) libs/agno_infra/agno/aws/resource/elb/target_group.py:39 — TargetGroup._create has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (21 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DockerApp.get_container_env (cognitive 25) · ×1
  • DockerApp.get_container_env (cognitive 25) libs/agno_infra/agno/docker/app/base.py:131 — DockerApp.get_container_env has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAdapter._replace_section (cognitive 25) · ×1
  • CodexAdapter._replace_section (cognitive 25) libs/agnoctl/agnoctl/clients/codex.py:196 — CodexAdapter._replace_section has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cancel_run.long_running_task (cognitive 25) · ×1
  • cancel_run.long_running_task (cognitive 25) cookbook/03_teams/14_run_control/cancel_run.py:22 — cancel_run.long_running_task has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 5 (9 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · save_hitl_condition_loop_router.run_workflow (cognitive 25) · ×1
  • save_hitl_condition_loop_router.run_workflow (cognitive 25) cookbook/93_components/workflows/save_hitl_condition_loop_router.py:199 — save_hitl_condition_loop_router.run_workflow has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (9 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._build_continue_run_messages (cognitive 24) · ×1
  • _messages._build_continue_run_messages (cognitive 24) libs/agno/agno/agent/_messages.py:2309 — _messages._build_continue_run_messages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run.resolve_run_dependencies (cognitive 24) · ×1
  • _run.resolve_run_dependencies (cognitive 24) libs/agno/agno/agent/_run.py:142 — _run.resolve_run_dependencies has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools.get_tools (cognitive 24) · ×1
  • _tools.get_tools (cognitive 24) libs/agno/agno/agent/_tools.py:202 — _tools.get_tools has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · routines._authorize_auto_accept (cognitive 24) · ×1
  • routines._authorize_auto_accept (cognitive 24) libs/agno/agno/company/routines.py:257 — routines._authorize_auto_accept has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 3 (7 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncBaseDb.__init__ (cognitive 24) · ×1
  • AsyncBaseDb.__init__ (cognitive 24) libs/agno/agno/db/base.py:2644 — AsyncBaseDb.__init__ has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 22, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DynamoDb.get_user_memories (cognitive 24) · ×1
  • DynamoDb.get_user_memories (cognitive 24) libs/agno/agno/db/dynamo/dynamo.py:1297 — DynamoDb.get_user_memories has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_user_memory_stats (cognitive 24) · ×1
  • DynamoDb.get_user_memory_stats (cognitive 24) libs/agno/agno/db/dynamo/dynamo.py:1417 — DynamoDb.get_user_memory_stats has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, loops 2, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_eval_runs (cognitive 24) · ×1
  • DynamoDb.get_eval_runs (cognitive 24) libs/agno/agno/db/dynamo/dynamo.py:2333 — DynamoDb.get_eval_runs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 4 (5 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncMySQLDb.upsert_knowledge_content (cognitive 24) · ×1
  • AsyncMySQLDb.upsert_knowledge_content (cognitive 24) libs/agno/agno/db/mysql/async_mysql.py:2398 — AsyncMySQLDb.upsert_knowledge_content has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MySQLDb.upsert_knowledge_content (cognitive 24) · ×1
  • MySQLDb.upsert_knowledge_content (cognitive 24) libs/agno/agno/db/mysql/mysql.py:2370 — MySQLDb.upsert_knowledge_content has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb.get_runs (cognitive 24) · ×1
  • RedisDb.get_runs (cognitive 24) libs/agno/agno/db/redis/redis.py:484 — RedisDb.get_runs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 2 (5 pts), error handling 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb.get_metrics (cognitive 24) · ×1
  • RedisDb.get_metrics (cognitive 24) libs/agno/agno/db/redis/redis.py:1507 — RedisDb.get_metrics has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb.get_eval_runs (cognitive 24) · ×1
  • AsyncSqliteDb.get_eval_runs (cognitive 24) REDACTED:3128 — AsyncSqliteDb.get_eval_runs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · runner._mcp_tool_names (cognitive 24) · ×1
  • runner._mcp_tool_names (cognitive 24) libs/agno/agno/environments/runner.py:724 — runner._mcp_tool_names has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PerformanceEval.run (cognitive 24) · ×1
  • PerformanceEval.run (cognitive 24) libs/agno/agno/eval/performance.py:497 — PerformanceEval.run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (PerformanceEval.arun) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PerformanceEval.arun (cognitive 24) · ×1
  • PerformanceEval.arun (cognitive 24) libs/agno/agno/eval/performance.py:634 — PerformanceEval.arun has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (PerformanceEval.run) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · S3Loader._load_from_s3 (cognitive 24) · ×1
  • S3Loader._load_from_s3 (cognitive 24) libs/agno/agno/knowledge/loaders/s3.py:169 — S3Loader._load_from_s3 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4 (7 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Groq.parse_tool_calls (cognitive 24) · ×1
  • Groq.parse_tool_calls (cognitive 24) libs/agno/agno/models/groq/groq.py:447 — Groq.parse_tool_calls has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HuggingFace.parse_tool_calls (cognitive 24) · ×1
  • HuggingFace.parse_tool_calls (cognitive 24) libs/agno/agno/models/huggingface/huggingface.py:373 — HuggingFace.parse_tool_calls has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · input.extract_user_input (cognitive 24) · ×1
  • input.extract_user_input (cognitive 24) REDACTED:17 — input.extract_user_input has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.team_continue_response_streamer (cognitive 24) · ×1
  • router.team_continue_response_streamer (cognitive 24) libs/agno/agno/os/routers/teams/router.py:412 — router.team_continue_response_streamer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), boolean chains 5, error handling 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChartTools._build_spec (cognitive 24) · ×1
  • ChartTools._build_spec (cognitive 24) libs/agno/agno/tools/chart.py:166 — ChartTools._build_spec has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleCalendarTools.__init__ (cognitive 24) · ×1
  • GoogleCalendarTools.__init__ (cognitive 24) libs/agno/agno/tools/google/calendar.py:50 — GoogleCalendarTools.__init__ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Toolkit._check_tools_filters (cognitive 24) · ×1
  • Toolkit._check_tools_filters (cognitive 24) libs/agno/agno/tools/toolkit.py:216 — Toolkit._check_tools_filters has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.store_media_util (cognitive 24) · ×1
  • agent.store_media_util (cognitive 24) libs/agno/agno/utils/agent.py:364 — agent.store_media_util has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (agent.validate_media_object_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · agent.validate_media_object_id (cognitive 24) · ×1
  • agent.validate_media_object_id (cognitive 24) libs/agno/agno/utils/agent.py:392 — agent.validate_media_object_id has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (agent.store_media_util) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · cohere.format_messages (cognitive 24) · ×1
  • cohere.format_messages (cognitive 24) libs/agno/agno/utils/models/cohere.py:49 — cohere.format_messages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · string.parse_response_model_str (cognitive 24) · ×1
  • string.parse_response_model_str (cognitive 24) libs/agno/agno/utils/string.py:195 — string.parse_response_model_str has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 5 (10 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Milvus.async_upsert (cognitive 24) · ×1
  • Milvus.async_upsert (cognitive 24) REDACTED:770 — Milvus.async_upsert has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (5 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PgVector.vector_search (cognitive 24) · ×1
  • PgVector.vector_search (cognitive 24) REDACTED:1044 — PgVector.vector_search has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 2 (5 pts), error handling 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Condition.from_dict (cognitive 24) · ×1
  • Condition.from_dict (cognitive 24) libs/agno/agno/workflow/condition.py:200 — Condition.from_dict has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.from_dict (cognitive 24) · ×1
  • Router.from_dict (cognitive 24) libs/agno/agno/workflow/router.py:242 — Router.from_dict has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StepRequirement._validate_user_input (cognitive 24) · ×1
  • StepRequirement._validate_user_input (cognitive 24) libs/agno/agno/workflow/types.py:953 — StepRequirement._validate_user_input has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContinueExecutionState.__init__ (cognitive 24) · ×1
  • ContinueExecutionState.__init__ (cognitive 24) libs/agno/agno/workflow/utils/hitl.py:406 — ContinueExecutionState.__init__ has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 18, if/else 2 (4 pts), loops 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Workflow._propagate_debug_to_step (cognitive 24) · ×1
  • Workflow._propagate_debug_to_step (cognitive 24) libs/agno/agno/workflow/workflow.py:2784 — Workflow._propagate_debug_to_step has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrate_sentinel_vectordbs._indexed_vector_dimensions (cognitive 24) · ×1
  • migrate_sentinel_vectordbs._indexed_vector_dimensions (cognitive 24) libs/agno/migrations/v2_to_v3/migrate_sentinel_vectordbs.py:63 — migrate_sentinel_vectordbs._indexed_vector_dimensions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 3 (6 pts), ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EcsContainer.build_container_environment (cognitive 24) · ×1
  • EcsContainer.build_container_environment (cognitive 24) libs/agno_infra/agno/aws/resource/ecs/container.py:180 — EcsContainer.build_container_environment has cognitive complexity 24 (threshold 15). Drivers by points: error handling 3 (11 pts), if/else 5 (9 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 02_tool_error_persistence.scenario_b_model_call_fails (cognitive 24) · ×1
  • 02_tool_error_persistence.scenario_b_model_call_fails (cognitive 24) cookbook/03_teams/23_checkpointing/02_tool_error_persistence.py:85 — 02_tool_error_persistence.scenario_b_model_call_fails has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, loops 2 (4 pts), ternaries 1 (4 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DictPolicyEngine.accessible_resource_ids (cognitive 24) · ×1
  • DictPolicyEngine.accessible_resource_ids (cognitive 24) cookbook/05_agent_os/26_authorization/14_custom_policy_engine.py:149 — DictPolicyEngine.accessible_resource_ids has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._truncate_run_to_checkpoint (cognitive 23) · ×1
  • _run._truncate_run_to_checkpoint (cognitive 23) libs/agno/agno/agent/_run.py:2943 — _run._truncate_run_to_checkpoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeAgent._annotate_run_output (cognitive 23) · ×1
  • ClaudeAgent._annotate_run_output (cognitive 23) libs/agno/agno/agents/claude/agent.py:592 — ClaudeAgent._annotate_run_output has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Compaction.__post_init__ (cognitive 23) · ×1
  • Compaction.__post_init__ (cognitive 23) libs/agno/agno/compaction/compaction.py:158 — Compaction.__post_init__ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, boolean chains 10. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncMongoDb.get_eval_runs (cognitive 23) · ×1
  • AsyncMongoDb.get_eval_runs (cognitive 23) libs/agno/agno/db/mongo/async_mongo.py:2350 — AsyncMongoDb.get_eval_runs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (17 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MongoDb.get_eval_runs (cognitive 23) · ×1
  • MongoDb.get_eval_runs (cognitive 23) libs/agno/agno/db/mongo/mongo.py:2155 — MongoDb.get_eval_runs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (17 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MySQLDb.get_eval_runs (cognitive 23) · ×1
  • MySQLDb.get_eval_runs (cognitive 23) libs/agno/agno/db/mysql/mysql.py:2574 — MySQLDb.get_eval_runs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PostgresDb.get_eval_runs (cognitive 23) · ×1
  • PostgresDb.get_eval_runs (cognitive 23) libs/agno/agno/db/postgres/postgres.py:3521 — PostgresDb.get_eval_runs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PostgresDb.restore_component (cognitive 23) · ×1
  • PostgresDb.restore_component (cognitive 23) libs/agno/agno/db/postgres/postgres.py:4956 — PostgresDb.restore_component has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStoreDb.get_eval_runs (cognitive 23) · ×1
  • SingleStoreDb.get_eval_runs (cognitive 23) libs/agno/agno/db/singlestore/singlestore.py:2570 — SingleStoreDb.get_eval_runs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SqliteDb.get_eval_runs (cognitive 23) · ×1
  • SqliteDb.get_eval_runs (cognitive 23) REDACTED:3381 — SqliteDb.get_eval_runs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SqliteDb.restore_component (cognitive 23) · ×1
  • SqliteDb.restore_component (cognitive 23) REDACTED:4797 — SqliteDb.restore_component has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiEmbedder.async_get_embeddings_batch_and_usage (cognitive 23) · ×1
  • GeminiEmbedder.async_get_embeddings_batch_and_usage (cognitive 23) libs/agno/agno/knowledge/embedder/google.py:193 — GeminiEmbedder.async_get_embeddings_batch_and_usage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileSystemKnowledge._list_files (cognitive 23) · ×1
  • FileSystemKnowledge._list_files (cognitive 23) libs/agno/agno/knowledge/filesystem.py:91 — FileSystemKnowledge._list_files has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AzureBlobLoader._aload_from_azure_blob (cognitive 23) · ×1
  • AzureBlobLoader._aload_from_azure_blob (cognitive 23) libs/agno/agno/knowledge/loaders/azure_blob.py:148 — AzureBlobLoader._aload_from_azure_blob has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 5 (7 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AzureBlobLoader._load_from_azure_blob) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AzureBlobLoader._load_from_azure_blob (cognitive 23) · ×1
  • AzureBlobLoader._load_from_azure_blob (cognitive 23) libs/agno/agno/knowledge/loaders/azure_blob.py:297 — AzureBlobLoader._load_from_azure_blob has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 5 (7 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AzureBlobLoader._aload_from_azure_blob) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · PageCoordinator._setup_complete (cognitive 23) · ×1
  • PageCoordinator._setup_complete (cognitive 23) REDACTED:306 — PageCoordinator._setup_complete has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CSVReader.async_read (cognitive 23) · ×1
  • CSVReader.async_read (cognitive 23) libs/agno/agno/knowledge/reader/csv_reader.py:133 — CSVReader.async_read has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 2 (4 pts), error handling 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · public_fetch._fetch (cognitive 23) · ×1
  • public_fetch._fetch (cognitive 23) libs/agno/agno/knowledge/reader/utils/public_fetch.py:48 — public_fetch._fetch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionContextStore._get_system_message (cognitive 23) · ×1
  • SessionContextStore._get_system_message (cognitive 23) libs/agno/agno/learn/stores/session_context.py:680 — SessionContextStore._get_system_message has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryManager._search_user_memories_agentic (cognitive 23) · ×1
  • MemoryManager._search_user_memories_agentic (cognitive 23) libs/agno/agno/memory/manager.py:660 — MemoryManager._search_user_memories_agentic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (6 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metrics.accumulate_model_metrics (cognitive 23) · ×1
  • metrics.accumulate_model_metrics (cognitive 23) libs/agno/agno/metrics.py:632 — metrics.accumulate_model_metrics has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (8 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Claude._ensure_additional_properties_false (cognitive 23) · ×1
  • Claude._ensure_additional_properties_false (cognitive 23) libs/agno/agno/models/anthropic/claude.py:317 — Claude._ensure_additional_properties_false has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (7 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Model._process_model_response (cognitive 23) · ×1
  • Model._process_model_response (cognitive 23) REDACTED:1107 — Model._process_model_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (Model._aprocess_model_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Model._aprocess_model_response (cognitive 23) · ×1
  • Model._aprocess_model_response (cognitive 23) REDACTED:1177 — Model._aprocess_model_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (Model._process_model_response) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · minimax._strip_inline_think_tags (cognitive 23) · ×1
  • minimax._strip_inline_think_tags (cognitive 23) libs/agno/agno/models/minimax/minimax.py:95 — minimax._strip_inline_think_tags has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._add_auth_middleware (cognitive 23) · ×1
  • AgentOS._add_auth_middleware (cognitive 23) libs/agno/agno/os/app.py:2291 — AgentOS._add_auth_middleware has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 10, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · QueueWorker.acancel_queued (cognitive 23) · ×1
  • QueueWorker.acancel_queued (cognitive 23) libs/agno/agno/os/job_queue.py:1240 — QueueWorker.acancel_queued has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, error handling 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.get_run_input (cognitive 23) · ×1
  • utils.get_run_input (cognitive 23) libs/agno/agno/os/utils.py:970 — utils.get_run_input has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.resolve_team (cognitive 23) · ×1
  • utils.resolve_team (cognitive 23) libs/agno/agno/os/utils.py:3051 — utils.resolve_team has cognitive complexity 23 (threshold 15). Drivers by points: error handling 7 (14 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (utils.resolve_workflow) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.resolve_workflow (cognitive 23) · ×1
  • utils.resolve_workflow (cognitive 23) libs/agno/agno/os/utils.py:3132 — utils.resolve_workflow has cognitive complexity 23 (threshold 15). Drivers by points: error handling 7 (14 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (utils.resolve_team) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._ahandle_team_tool_call_updates (cognitive 23) · ×1
  • _run._ahandle_team_tool_call_updates (cognitive 23) libs/agno/agno/team/_run.py:5520 — _run._ahandle_team_tool_call_updates has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, loops 3 (8 pts), if/else 4 (7 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_run._ahandle_team_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._ahandle_team_tool_call_updates_stream (cognitive 23) · ×1
  • _run._ahandle_team_tool_call_updates_stream (cognitive 23) libs/agno/agno/team/_run.py:5598 — _run._ahandle_team_tool_call_updates_stream has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, loops 3 (8 pts), if/else 4 (7 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_run._ahandle_team_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._truncate_team_run_to_checkpoint (cognitive 23) · ×1
  • _run._truncate_team_run_to_checkpoint (cognitive 23) libs/agno/agno/team/_run.py:6910 — _run._truncate_team_run_to_checkpoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools._check_and_refresh_mcp_tools (cognitive 23) · ×1
  • _tools._check_and_refresh_mcp_tools (cognitive 23) libs/agno/agno/team/_tools.py:88 — _tools._check_and_refresh_mcp_tools has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 1 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · KernelSession._run_silent (cognitive 23) · ×1
  • KernelSession._run_silent (cognitive 23) libs/agno/agno/tools/code/kernel.py:834 — KernelSession._run_silent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (7 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodingTools.ls (cognitive 23) · ×1
  • CodingTools.ls (cognitive 23) libs/agno/agno/tools/coding.py:820 — CodingTools.ls has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 3 (5 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DaytonaTools._get_or_create_sandbox (cognitive 23) · ×1
  • DaytonaTools._get_or_create_sandbox (cognitive 23) libs/agno/agno/tools/daytona.py:166 — DaytonaTools._get_or_create_sandbox has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 3 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleCalendarTools.update_event (cognitive 23) · ×1
  • GoogleCalendarTools.update_event (cognitive 23) libs/agno/agno/tools/google/calendar.py:348 — GoogleCalendarTools.update_event has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 3 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ModelsLabTools.generate_media (cognitive 23) · ×1
  • ModelsLabTools.generate_media (cognitive 23) libs/agno/agno/tools/models_labs.py:164 — ModelsLabTools.generate_media has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, ternaries 3, error handling 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · OxylabsTools.get_amazon_product (cognitive 23) · ×1
  • OxylabsTools.get_amazon_product (cognitive 23) libs/agno/agno/tools/oxylabs.py:166 — OxylabsTools.get_amazon_product has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (7 pts), boolean chains 6, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParallelTools.parallel_search (cognitive 23) · ×1
  • ParallelTools.parallel_search (cognitive 23) libs/agno/agno/tools/parallel.py:128 — ParallelTools.parallel_search has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, ternaries 3, boolean chains 2, error handling 2, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RedmineTools.search_issues (cognitive 23) · ×1
  • RedmineTools.search_issues (cognitive 23) libs/agno/agno/tools/redmine.py:282 — RedmineTools.search_issues has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4 (8 pts), error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackTools._resolve_channel (cognitive 23) · ×1
  • SlackTools._resolve_channel (cognitive 23) libs/agno/agno/tools/slack.py:362 — SlackTools._resolve_channel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools.create_schedule (cognitive 23) · ×1
  • StudioTools.create_schedule (cognitive 23) libs/agno/agno/tools/studio.py:4456 — StudioTools.create_schedule has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 4 (7 pts), boolean chains 3, ternaries 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StudioRunnerTools._step_list_divergence (cognitive 23) · ×1
  • StudioRunnerTools._step_list_divergence (cognitive 23) libs/agno/agno/tools/studio_runner.py:771 — StudioRunnerTools._step_list_divergence has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Milvus.async_insert (cognitive 23) · ×1
  • Milvus.async_insert (cognitive 23) REDACTED:598 — Milvus.async_insert has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (5 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Loop.from_dict (cognitive 23) · ×1
  • Loop.from_dict (cognitive 23) libs/agno/agno/workflow/loop.py:204 — Loop.from_dict has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Step._enrich_event_with_context (cognitive 23) · ×1
  • Step._enrich_event_with_context (cognitive 23) libs/agno/agno/workflow/step.py:1370 — Step._enrich_event_with_context has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow._handle_event (cognitive 23) · ×1
  • Workflow._handle_event (cognitive 23) libs/agno/agno/workflow/workflow.py:2640 — Workflow._handle_event has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Workflow._propagate_hooks_to_step (cognitive 23) · ×1
  • Workflow._propagate_hooks_to_step (cognitive 23) libs/agno/agno/workflow/workflow.py:11470 — Workflow._propagate_hooks_to_step has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · confirmation_required_mcp_toolkit.main (cognitive 23) · ×1
  • confirmation_required_mcp_toolkit.main (cognitive 23) cookbook/02_agents/10_human_in_the_loop/confirmation_required_mcp_toolkit.py:39 — confirmation_required_mcp_toolkit.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (7 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 02_tool_error_persistence.scenario_a_tool_error (cognitive 23) · ×1
  • 02_tool_error_persistence.scenario_a_tool_error (cognitive 23) cookbook/02_agents/18_checkpointing/02_tool_error_persistence.py:48 — 02_tool_error_persistence.scenario_a_tool_error has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, ternaries 2 (8 pts), loops 2 (5 pts), error handling 1, if/else 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tasks_stream.main (cognitive 23) · ×1
  • tasks_stream.main (cognitive 23) cookbook/03_teams/02_modes/tasks_stream.py:73 — tasks_stream.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · websocket_server.websocket_endpoint (cognitive 23) · ×1
  • websocket_server.websocket_endpoint (cognitive 23) cookbook/04_workflows/06_advanced_concepts/background_execution/websocket_server.py:81 — websocket_server.websocket_endpoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run.arun_dispatch (cognitive 22) · ×1
  • _run.arun_dispatch (cognitive 22) libs/agno/agno/agent/_run.py:2711 — _run.arun_dispatch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ClaudeAgent._tool_batches (cognitive 22) · ×1
  • ClaudeAgent._tool_batches (cognitive 22) libs/agno/agno/agents/claude/agent.py:646 — ClaudeAgent._tool_batches has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 8, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.validate_google_credentials (cognitive 22) · ×1
  • utils.validate_google_credentials (cognitive 22) libs/agno/agno/context/google/utils.py:14 — utils.validate_google_credentials has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 3 (5 pts), boolean chains 3, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · notion_ops.blocks_to_markdown (cognitive 22) · ×1
  • notion_ops.blocks_to_markdown (cognitive 22) libs/agno/agno/context/wiki/notion_ops.py:173 — notion_ops.blocks_to_markdown has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (6 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.calculate_metrics (cognitive 22) · ×1
  • GcsJsonDb.calculate_metrics (cognitive 22) libs/agno/agno/db/gcs_json/gcs_json_db.py:1096 — GcsJsonDb.calculate_metrics has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.calculate_metrics (cognitive 22) · ×1
  • JsonDb.calculate_metrics (cognitive 22) libs/agno/agno/db/json/json_db.py:1163 — JsonDb.calculate_metrics has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v1_to_v2.migrate_table_in_batches (cognitive 22) · ×1
  • v1_to_v2.migrate_table_in_batches (cognitive 22) REDACTED:383 — v1_to_v2.migrate_table_in_batches has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._migrate_sqlite_user_id (cognitive 22) · ×1
  • v3_0_0._migrate_sqlite_user_id (cognitive 22) REDACTED:3661 — v3_0_0._migrate_sqlite_user_id has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._migrate_async_sqlite_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · v3_0_0._migrate_async_sqlite_user_id (cognitive 22) · ×1
  • v3_0_0._migrate_async_sqlite_user_id (cognitive 22) REDACTED:3734 — v3_0_0._migrate_async_sqlite_user_id has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._migrate_sqlite_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsyncSqliteDb.get_runs (cognitive 22) · ×1
  • AsyncSqliteDb.get_runs (cognitive 22) REDACTED:1006 — AsyncSqliteDb.get_runs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SqliteDb.get_runs (cognitive 22) · ×1
  • SqliteDb.get_runs (cognitive 22) REDACTED:1191 — SqliteDb.get_runs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · metrics.calculate_date_metrics (cognitive 22) · ×1
  • metrics.calculate_date_metrics (cognitive 22) libs/agno/agno/db/surrealdb/metrics.py:274 — metrics.calculate_date_metrics has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (12 pts), boolean chains 4, if/else 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SurrealDb.get_traces (cognitive 22) · ×1
  • SurrealDb.get_traces (cognitive 22) libs/agno/agno/db/surrealdb/surrealdb.py:1935 — SurrealDb.get_traces has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (8 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._mcp_tool_instances (cognitive 22) · ×1
  • runner._mcp_tool_instances (cognitive 22) libs/agno/agno/environments/runner.py:696 — runner._mcp_tool_instances has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (5 pts), ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParallelPageFetcher.afetch_many (cognitive 22) · ×1
  • ParallelPageFetcher.afetch_many (cognitive 22) libs/agno/agno/knowledge/reader/page_fetcher.py:271 — ParallelPageFetcher.afetch_many has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cerebras._parse_provider_response_delta (cognitive 22) · ×1
  • Cerebras._parse_provider_response_delta (cognitive 22) libs/agno/agno/models/cerebras/cerebras.py:492 — Cerebras._parse_provider_response_delta has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (12 pts), if/else 5 (10 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Gemini.count_tokens (cognitive 22) · ×1
  • Gemini.count_tokens (cognitive 22) libs/agno/agno/models/google/gemini.py:440 — Gemini.count_tokens has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Gemini.acount_tokens) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Gemini.acount_tokens (cognitive 22) · ×1
  • Gemini.acount_tokens (cognitive 22) libs/agno/agno/models/google/gemini.py:495 — Gemini.acount_tokens has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Gemini.count_tokens) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Llama.parse_tool_calls (cognitive 22) · ×1
  • Llama.parse_tool_calls (cognitive 22) libs/agno/agno/models/meta/llama.py:330 — Llama.parse_tool_calls has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIResponses.invoke_stream (cognitive 22) · ×1
  • OpenAIResponses.invoke_stream (cognitive 22) libs/agno/agno/models/openai/responses.py:1106 — OpenAIResponses.invoke_stream has cognitive complexity 22 (threshold 15). Drivers by points: error handling 8 (10 pts), ternaries 3 (6 pts), if/else 3 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIResponses.ainvoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · OpenAIResponses.ainvoke_stream (cognitive 22) · ×1
  • OpenAIResponses.ainvoke_stream (cognitive 22) libs/agno/agno/models/openai/responses.py:1215 — OpenAIResponses.ainvoke_stream has cognitive complexity 22 (threshold 15). Drivers by points: error handling 8 (10 pts), ternaries 3 (6 pts), if/else 3 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIResponses.invoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AgentOS._raise_if_duplicate_ids (cognitive 22) · ×1
  • AgentOS._raise_if_duplicate_ids (cognitive 22) libs/agno/agno/os/app.py:1125 — AgentOS._raise_if_duplicate_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._get_filesystem_config (cognitive 22) · ×1
  • AgentOS._get_filesystem_config (cognitive 22) libs/agno/agno/os/app.py:3059 — AgentOS._get_filesystem_config has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 2 (5 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RoleStore.patch_role_scopes (cognitive 22) · ×1
  • RoleStore.patch_role_scopes (cognitive 22) libs/agno/agno/os/authz/_role_store.py:497 — RoleStore.patch_role_scopes has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 6, if/else 4 (5 pts), loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RoleStore.apatch_role_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RoleStore.apatch_role_scopes (cognitive 22) · ×1
  • RoleStore.apatch_role_scopes (cognitive 22) libs/agno/agno/os/authz/_role_store.py:1008 — RoleStore.apatch_role_scopes has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 6, if/else 4 (5 pts), loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RoleStore.patch_role_scopes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · MCPConfig._check_has_tools (cognitive 22) · ×1
  • MCPConfig._check_has_tools (cognitive 22) libs/agno/agno/os/config.py:373 — MCPConfig._check_has_tools has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (8 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlackEventHandler.handle_streaming (cognitive 22) · ×1
  • SlackEventHandler.handle_streaming (cognitive 22) libs/agno/agno/os/interfaces/slack/event_handler.py:398 — SlackEventHandler.handle_streaming has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 1 (3 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · helpers.extract_message_payload (cognitive 22) · ×1
  • helpers.extract_message_payload (cognitive 22) libs/agno/agno/os/interfaces/telegram/helpers.py:57 — helpers.extract_message_payload has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · user_scope.verify_run_belongs_to_component (cognitive 22) · ×1
  • user_scope.verify_run_belongs_to_component (cognitive 22) libs/agno/agno/os/middleware/user_scope.py:626 — user_scope.verify_run_belongs_to_component has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.run_performance_eval (cognitive 22) · ×1
  • utils.run_performance_eval (cognitive 22) libs/agno/agno/os/routers/evals/utils.py:120 — utils.run_performance_eval has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 5, if/else 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router._merge_entries (cognitive 22) · ×1
  • router._merge_entries (cognitive 22) libs/agno/agno/os/routers/filesystem/router.py:209 — router._merge_entries has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run_permissions._require_endpoint_permission (cognitive 22) · ×1
  • run_permissions._require_endpoint_permission (cognitive 22) libs/agno/agno/os/routers/run_permissions.py:14 — run_permissions._require_endpoint_permission has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 4 (7 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.update_cors_middleware (cognitive 22) · ×1
  • utils.update_cors_middleware (cognitive 22) libs/agno/agno/os/utils.py:2184 — utils.update_cors_middleware has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TeamSession.get_team_history (cognitive 22) · ×1
  • TeamSession.get_team_history (cognitive 22) libs/agno/agno/session/team.py:307 — TeamSession.get_team_history has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run.drop_opted_out_member_media (cognitive 22) · ×1
  • _run.drop_opted_out_member_media (cognitive 22) libs/agno/agno/team/_run.py:5112 — _run.drop_opted_out_member_media has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage._aread_or_create_session (cognitive 22) · ×1
  • _storage._aread_or_create_session (cognitive 22) libs/agno/agno/team/_storage.py:390 — _storage._aread_or_create_session has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · toolkit._clean (cognitive 22) · ×1
  • toolkit._clean (cognitive 22) libs/agno/agno/tools/finance/toolkit.py:712 — toolkit._clean has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StudioRunnerTools._resolve_db_id_by_name (cognitive 22) · ×1
  • StudioRunnerTools._resolve_db_id_by_name (cognitive 22) libs/agno/agno/tools/studio_runner.py:1008 — StudioRunnerTools._resolve_db_id_by_name has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValyuTools._parse_results (cognitive 22) · ×1
  • ValyuTools._parse_results (cognitive 22) libs/agno/agno/tools/valyu.py:81 — ValyuTools._parse_results has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WhatsAppTools.__init__ (cognitive 22) · ×1
  • WhatsAppTools.__init__ (cognitive 22) libs/agno/agno/tools/whatsapp.py:35 — WhatsAppTools.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WorkflowTools.__init__ (cognitive 22) · ×1
  • WorkflowTools.__init__ (cognitive 22) libs/agno/agno/tools/workflow.py:19 — WorkflowTools.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · json_schema.get_json_schema (cognitive 22) · ×1
  • json_schema.get_json_schema (cognitive 22) libs/agno/agno/utils/json_schema.py:201 — json_schema.get_json_schema has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parallel._aggregate_results (cognitive 22) · ×1
  • Parallel._aggregate_results (cognitive 22) libs/agno/agno/workflow/parallel.py:182 — Parallel._aggregate_results has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 pts), ternaries 4, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CacheCluster._update (cognitive 22) · ×1
  • CacheCluster._update (cognitive 22) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:286 — CacheCluster._update has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PostgresDb.get_container_env (cognitive 22) · ×1
  • PostgresDb.get_container_env (cognitive 22) libs/agno_infra/agno/docker/app/postgres/postgres.py:61 — PostgresDb.get_container_env has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · mcp_client._parse_jsonrpc_body (cognitive 22) · ×1
  • mcp_client._parse_jsonrpc_body (cognitive 22) libs/agnoctl/agnoctl/mcp_client.py:43 — mcp_client._parse_jsonrpc_body has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 2 (6 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · 11_streaming_events.streaming_with_events (cognitive 22) · ×1
  • 11_streaming_events.streaming_with_events (cognitive 22) cookbook/03_teams/02_modes/tasks/11_streaming_events.py:74 — 11_streaming_events.streaming_with_events has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · soak.main (cognitive 22) · ×1
  • soak.main (cognitive 22) cookbook/frameworks/reliability/soak.py:82 — soak.main has cognitive complexity 22 (threshold 15). Drivers by points: loops 10 (15 pts), if/else 3 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · _response.get_response_format (cognitive 21) · ×1
  • _response.get_response_format (cognitive 21) libs/agno/agno/agent/_response.py:857 — _response.get_response_format has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _session.get_session (cognitive 21) · ×1
  • _session.get_session (cognitive 21) libs/agno/agno/agent/_session.py:75 — _session.get_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _storage.aread_or_create_session (cognitive 21) · ×1
  • _storage.aread_or_create_session (cognitive 21) libs/agno/agno/agent/_storage.py:719 — _storage.aread_or_create_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAgent._tool_from_item (cognitive 21) · ×1
  • CodexAgent._tool_from_item (cognitive 21) libs/agno/agno/agents/codex/agent.py:1075 — CodexAgent._tool_from_item has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · execution._validate_executor_tools (cognitive 21) · ×1
  • execution._validate_executor_tools (cognitive 21) libs/agno/agno/company/execution.py:553 — execution._validate_executor_tools has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sources._documents (cognitive 21) · ×1
  • sources._documents (cognitive 21) libs/agno/agno/company/sources.py:193 — sources._documents has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.delete_sessions (cognitive 21) · ×1
  • DynamoDb.delete_sessions (cognitive 21) libs/agno/agno/db/dynamo/dynamo.py:636 — DynamoDb.delete_sessions has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (8 pts), error handling 3 (6 pts), if/else 4 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.calculate_metrics (cognitive 21) · ×1
  • InMemoryDb.calculate_metrics (cognitive 21) libs/agno/agno/db/in_memory/in_memory_db.py:937 — InMemoryDb.calculate_metrics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._revert_dynamodb (cognitive 21) · ×1
  • v3_0_0._revert_dynamodb (cognitive 21) REDACTED:2320 — v3_0_0._revert_dynamodb has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 4 (7 pts), loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMySQLDb.get_runs (cognitive 21) · ×1
  • AsyncMySQLDb.get_runs (cognitive 21) libs/agno/agno/db/mysql/async_mysql.py:735 — AsyncMySQLDb.get_runs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncMySQLDb.get_user_memories (cognitive 21) · ×1
  • AsyncMySQLDb.get_user_memories (cognitive 21) libs/agno/agno/db/mysql/async_mysql.py:1690 — AsyncMySQLDb.get_user_memories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncMySQLDb.upsert_memories (cognitive 21) · ×1
  • AsyncMySQLDb.upsert_memories (cognitive 21) libs/agno/agno/db/mysql/async_mysql.py:1939 — AsyncMySQLDb.upsert_memories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MySQLDb.upsert_memories (cognitive 21) · ×1
  • MySQLDb.upsert_memories (cognitive 21) libs/agno/agno/db/mysql/mysql.py:1910 — MySQLDb.upsert_memories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncPostgresDb.get_runs (cognitive 21) · ×1
  • AsyncPostgresDb.get_runs (cognitive 21) libs/agno/agno/db/postgres/async_postgres.py:1055 — AsyncPostgresDb.get_runs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncPostgresDb.get_user_memories (cognitive 21) · ×1
  • AsyncPostgresDb.get_user_memories (cognitive 21) libs/agno/agno/db/postgres/async_postgres.py:2089 — AsyncPostgresDb.get_user_memories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncPostgresDb.update_run_in_session (cognitive 21) · ×1
  • AsyncPostgresDb.update_run_in_session (cognitive 21) libs/agno/agno/db/postgres/async_postgres.py:4839 — AsyncPostgresDb.update_run_in_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PostgresDb.update_run_in_session (cognitive 21) · ×1
  • PostgresDb.update_run_in_session (cognitive 21) libs/agno/agno/db/postgres/postgres.py:7583 — PostgresDb.update_run_in_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RedisDb.get_trace (cognitive 21) · ×1
  • RedisDb.get_trace (cognitive 21) libs/agno/agno/db/redis/redis.py:2067 — RedisDb.get_trace has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb.upsert_memories (cognitive 21) · ×1
  • AsyncSqliteDb.upsert_memories (cognitive 21) REDACTED:2440 — AsyncSqliteDb.upsert_memories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.upsert_memories (cognitive 21) · ×1
  • SqliteDb.upsert_memories (cognitive 21) REDACTED:2695 — SqliteDb.upsert_memories has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DbFileSystem.append (cognitive 21) · ×1
  • DbFileSystem.append (cognitive 21) REDACTED:506 — DbFileSystem.append has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (7 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileSystemTools.list_files (cognitive 21) · ×1
  • FileSystemTools.list_files (cognitive 21) libs/agno/agno/fs/toolkit.py:307 — FileSystemTools.list_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 2, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FileSystemTools.alist_files) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · FileSystemTools.alist_files (cognitive 21) · ×1
  • FileSystemTools.alist_files (cognitive 21) libs/agno/agno/fs/toolkit.py:733 — FileSystemTools.alist_files has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 2, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (FileSystemTools.list_files) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._build_content_hash (cognitive 21) · ×1
  • Knowledge._build_content_hash (cognitive 21) libs/agno/agno/knowledge/knowledge.py:4190 — Knowledge._build_content_hash has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 3 (8 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCoordinator.__init__ (cognitive 21) · ×1
  • PageCoordinator.__init__ (cognitive 21) REDACTED:121 — PageCoordinator.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PageCoordinator._embeddings (cognitive 21) · ×1
  • PageCoordinator._embeddings (cognitive 21) REDACTED:570 — PageCoordinator._embeddings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CSVReader.read (cognitive 21) · ×1
  • CSVReader.read (cognitive 21) libs/agno/agno/knowledge/reader/csv_reader.py:66 — CSVReader.read has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, ternaries 2 (4 pts), error handling 3, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FieldLabeledCSVReader.read (cognitive 21) · ×1
  • FieldLabeledCSVReader.read (cognitive 21) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:93 — FieldLabeledCSVReader.read has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (3 pts), error handling 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.get_readers_availability (cognitive 21) · ×1
  • utils.get_readers_availability (cognitive 21) libs/agno/agno/knowledge/utils.py:260 — utils.get_readers_availability has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (6 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelMetrics.accumulate (cognitive 21) · ×1
  • ModelMetrics.accumulate (cognitive 21) libs/agno/agno/metrics.py:68 — ModelMetrics.accumulate has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (8 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MessageMetrics.__add__ (cognitive 21) · ×1
  • MessageMetrics.__add__ (cognitive 21) libs/agno/agno/metrics.py:196 — MessageMetrics.__add__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionMetrics.from_dict (cognitive 21) · ×1
  • SessionMetrics.from_dict (cognitive 21) libs/agno/agno/metrics.py:484 — SessionMetrics.from_dict has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (8 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Model._handle_function_call_media (cognitive 21) · ×1
  • Model._handle_function_call_media (cognitive 21) REDACTED:3152 — Model._handle_function_call_media has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (8 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HITLHandler._resolve_required_approvals (cognitive 21) · ×1
  • HITLHandler._resolve_required_approvals (cognitive 21) libs/agno/agno/os/interfaces/slack/hitl.py:420 — HITLHandler._resolve_required_approvals has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · interactions.confirmation_row_summary (cognitive 21) · ×1
  • interactions.confirmation_row_summary (cognitive 21) libs/agno/agno/os/interfaces/slack/interactions.py:193 — interactions.confirmation_row_summary has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 4, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueWorker._areconcile_swept_job (cognitive 21) · ×1
  • QueueWorker._areconcile_swept_job (cognitive 21) libs/agno/agno/os/job_queue.py:1169 — QueueWorker._areconcile_swept_job has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · components._normalize_link_versions (cognitive 21) · ×1
  • components._normalize_link_versions (cognitive 21) libs/agno/agno/os/routers/components/components.py:299 — components._normalize_link_versions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.workflow_continue_response_streamer (cognitive 21) · ×1
  • router.workflow_continue_response_streamer (cognitive 21) libs/agno/agno/os/routers/workflows/router.py:1330 — router.workflow_continue_response_streamer has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (6 pts), boolean chains 3, error handling 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scopes.get_accessible_resource_ids (cognitive 21) · ×1
  • scopes.get_accessible_resource_ids (cognitive 21) libs/agno/agno/os/scopes.py:349 — scopes.get_accessible_resource_ids has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Registry._rehydrate_function (cognitive 21) · ×1
  • Registry._rehydrate_function (cognitive 21) libs/agno/agno/registry/registry.py:368 — Registry._rehydrate_function has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · status_persist.apersist_worker_owned_run (cognitive 21) · ×1
  • status_persist.apersist_worker_owned_run (cognitive 21) libs/agno/agno/run/status_persist.py:254 — status_persist.apersist_worker_owned_run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalSkills.load (cognitive 21) · ×1
  • LocalSkills.load (cognitive 21) libs/agno/agno/skills/loaders/local.py:29 — LocalSkills.load has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _run.run_dispatch (cognitive 21) · ×1
  • _run.run_dispatch (cognitive 21) libs/agno/agno/team/_run.py:1901 — _run.run_dispatch has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 4, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DoclingTools.__init__ (cognitive 21) · ×1
  • DoclingTools.__init__ (cognitive 21) libs/agno/agno/tools/docling.py:48 — DoclingTools.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · YFinance.get_analyst_recommendations (cognitive 21) · ×1
  • YFinance.get_analyst_recommendations (cognitive 21) libs/agno/agno/tools/finance/providers/yfinance.py:322 — YFinance.get_analyst_recommendations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, error handling 3, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GoogleDriveTools.__init__ (cognitive 21) · ×1
  • GoogleDriveTools.__init__ (cognitive 21) libs/agno/agno/tools/google/drive.py:274 — GoogleDriveTools.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · JiraTools.__init__ (cognitive 21) · ×1
  • JiraTools.__init__ (cognitive 21) libs/agno/agno/tools/jira.py:15 — JiraTools.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MCPTools.build_tools (cognitive 21) · ×1
  • MCPTools.build_tools (cognitive 21) libs/agno/agno/tools/mcp/mcp.py:886 — MCPTools.build_tools has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), boolean chains 3, error handling 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresTools.summarize_table (cognitive 21) · ×1
  • PostgresTools.summarize_table (cognitive 21) libs/agno/agno/tools/postgres.py:174 — PostgresTools.summarize_table has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 1, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedshiftTools.summarize_table (cognitive 21) · ×1
  • RedshiftTools.summarize_table (cognitive 21) libs/agno/agno/tools/redshift.py:257 — RedshiftTools.summarize_table has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 1, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._build_steps (cognitive 21) · ×1
  • StudioTools._build_steps (cognitive 21) libs/agno/agno/tools/studio.py:5100 — StudioTools._build_steps has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TwilioTools.__init__ (cognitive 21) · ×1
  • TwilioTools.__init__ (cognitive 21) libs/agno/agno/tools/twilio.py:16 — TwilioTools.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · message.normalize_tool_messages (cognitive 21) · ×1
  • message.normalize_tool_messages (cognitive 21) libs/agno/agno/utils/message.py:72 — message.normalize_tool_messages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tokens.count_file_tokens (cognitive 21) · ×1
  • tokens.count_file_tokens (cognitive 21) REDACTED:308 — tokens.count_file_tokens has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (6 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Milvus.insert (cognitive 21) · ×1
  • Milvus.insert (cognitive 21) REDACTED:546 — Milvus.insert has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (6 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.drop (cognitive 21) · ×1
  • MongoDb.drop (cognitive 21) REDACTED:1034 — MongoDb.drop has cognitive complexity 21 (threshold 15). Drivers by points: error handling 3 (10 pts), if/else 5 (10 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PgVector.__init__ (cognitive 21) · ×1
  • PgVector.__init__ (cognitive 21) REDACTED:73 — PgVector.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PgVector.async_insert (cognitive 21) · ×1
  • PgVector.async_insert (cognitive 21) REDACTED:474 — PgVector.async_insert has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 3 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PgVector.hybrid_search (cognitive 21) · ×1
  • PgVector.hybrid_search (cognitive 21) REDACTED:1312 — PgVector.hybrid_search has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), error handling 3, ternaries 1 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ValkeyDb._parse_hash (cognitive 21) · ×1
  • ValkeyDb._parse_hash (cognitive 21) libs/agno/agno/vectordb/valkey/valkeydb.py:322 — ValkeyDb._parse_hash has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.to_dict (cognitive 21) · ×1
  • Workflow.to_dict (cognitive 21) libs/agno/agno/workflow/workflow.py:1212 — Workflow.to_dict has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AwsApp.get_container_env (cognitive 21) · ×1
  • AwsApp.get_container_env (cognitive 21) libs/agno_infra/agno/aws/app/base.py:180 — AwsApp.get_container_env has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsApp.security_group_definition (cognitive 21) · ×1
  • AwsApp.security_group_definition (cognitive 21) libs/agno_infra/agno/aws/app/base.py:262 — AwsApp.security_group_definition has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoadBalancer._create (cognitive 21) · ×1
  • LoadBalancer._create (cognitive 21) libs/agno_infra/agno/aws/resource/elb/load_balancer.py:34 — LoadBalancer._create has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 2 (4 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 02_tool_error_persistence.scenario_a_tool_error (cognitive 21) · ×1
  • 02_tool_error_persistence.scenario_a_tool_error (cognitive 21) cookbook/03_teams/23_checkpointing/02_tool_error_persistence.py:40 — 02_tool_error_persistence.scenario_a_tool_error has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 2 (8 pts), boolean chains 6, loops 2 (5 pts), error handling 1, if/else 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 03_step_confirmation_streaming.main (cognitive 21) · ×1
  • 03_step_confirmation_streaming.main (cognitive 21) cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:135 — 03_step_confirmation_streaming.main has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), loops 2 (4 pts), boolean chains 3, if/else 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 07_cascading_archive.main (cognitive 21) · ×1
  • 07_cascading_archive.main (cognitive 21) REDACTED:106 — 07_cascading_archive.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (9 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _init.get_models (cognitive 20) · ×1
  • _init.get_models (cognitive 20) libs/agno/agno/agent/_init.py:435 — _init.get_models has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _run.acontinue_run_dispatch (cognitive 20) · ×1
  • _run.acontinue_run_dispatch (cognitive 20) libs/agno/agno/agent/_run.py:4188 — _run.acontinue_run_dispatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _session.aget_session (cognitive 20) · ×1
  • _session.aget_session (cognitive 20) libs/agno/agno/agent/_session.py:155 — _session.aget_session has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _media.stage_prior_media (cognitive 20) · ×1
  • _media.stage_prior_media (cognitive 20) libs/agno/agno/agents/_media.py:370 — _media.stage_prior_media has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · execution._recover_task (cognitive 20) · ×1
  • execution._recover_task (cognitive 20) libs/agno/agno/company/execution.py:176 — execution._recover_task has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · execution._mount_executors (cognitive 20) · ×1
  • execution._mount_executors (cognitive 20) libs/agno/agno/company/execution.py:607 — execution._mount_executors has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb.delete_user_memories (cognitive 20) · ×1
  • FirestoreDb.delete_user_memories (cognitive 20) libs/agno/agno/db/firestore/firestore.py:1151 — FirestoreDb.delete_user_memories has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 6 (9 pts), error handling 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · GcsJsonDb._get_all_sessions_for_metrics_calculation (cognitive 20) · ×1
  • GcsJsonDb._get_all_sessions_for_metrics_calculation (cognitive 20) libs/agno/agno/db/gcs_json/gcs_json_db.py:1183 — GcsJsonDb._get_all_sessions_for_metrics_calculation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb._get_all_sessions_for_metrics_calculation (cognitive 20) · ×1
  • JsonDb._get_all_sessions_for_metrics_calculation (cognitive 20) libs/agno/agno/db/json/json_db.py:1252 — JsonDb._get_all_sessions_for_metrics_calculation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._revert_firestore (cognitive 20) · ×1
  • v3_0_0._revert_firestore (cognitive 20) REDACTED:1790 — v3_0_0._revert_firestore has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._revert_sqlite_user_id (cognitive 20) · ×1
  • v3_0_0._revert_sqlite_user_id (cognitive 20) REDACTED:4465 — v3_0_0._revert_sqlite_user_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._revert_async_sqlite_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · v3_0_0._revert_async_sqlite_user_id (cognitive 20) · ×1
  • v3_0_0._revert_async_sqlite_user_id (cognitive 20) REDACTED:4531 — v3_0_0._revert_async_sqlite_user_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._revert_sqlite_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsyncMongoDb.get_traces (cognitive 20) · ×1
  • AsyncMongoDb.get_traces (cognitive 20) libs/agno/agno/db/mongo/async_mongo.py:2763 — AsyncMongoDb.get_traces has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MongoDb.get_traces (cognitive 20) · ×1
  • MongoDb.get_traces (cognitive 20) libs/agno/agno/db/mongo/mongo.py:2627 — MongoDb.get_traces has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · utils.merge_runs_table_with_legacy_blob (cognitive 20) · ×1
  • utils.merge_runs_table_with_legacy_blob (cognitive 20) REDACTED:426 — utils.merge_runs_table_with_legacy_blob has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3, error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb._get_all_sessions_for_metrics_calculation (cognitive 20) · ×1
  • ValkeyDb._get_all_sessions_for_metrics_calculation (cognitive 20) libs/agno/agno/db/valkey/valkey.py:1731 — ValkeyDb._get_all_sessions_for_metrics_calculation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb.get_learnings_user_stats (cognitive 20) · ×1
  • ValkeyDb.get_learnings_user_stats (cognitive 20) libs/agno/agno/db/valkey/valkey.py:3312 — ValkeyDb.get_learnings_user_stats has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _engine._attempt_body (cognitive 20) · ×1
  • _engine._attempt_body (cognitive 20) libs/agno/agno/environments/_engine.py:134 — _engine._attempt_body has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentAsJudgeEval.run (cognitive 20) · ×1
  • AgentAsJudgeEval.run (cognitive 20) libs/agno/agno/eval/agent_as_judge.py:479 — AgentAsJudgeEval.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PageMarkdownChunking.chunk_pairs (cognitive 20) · ×1
  • PageMarkdownChunking.chunk_pairs (cognitive 20) libs/agno/agno/knowledge/chunking/page.py:174 — PageMarkdownChunking.chunk_pairs has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdf_reader._clean_page_numbers (cognitive 20) · ×1
  • pdf_reader._clean_page_numbers (cognitive 20) libs/agno/agno/knowledge/reader/pdf_reader.py:97 — pdf_reader._clean_page_numbers has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (11 pts), boolean chains 4, if/else 3, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore.asearch (cognitive 20) · ×1
  • EntityMemoryStore.asearch (cognitive 20) libs/agno/agno/learn/stores/entity_memory.py:3221 — EntityMemoryStore.asearch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (6 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · File._normalise_content (cognitive 20) · ×1
  • File._normalise_content (cognitive 20) libs/agno/agno/media/media.py:890 — File._normalise_content has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (7 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsBedrock._format_tools_for_request (cognitive 20) · ×1
  • AwsBedrock._format_tools_for_request (cognitive 20) libs/agno/agno/models/aws/bedrock.py:281 — AwsBedrock._format_tools_for_request has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsBedrock._parse_provider_response (cognitive 20) · ×1
  • AwsBedrock._parse_provider_response (cognitive 20) libs/agno/agno/models/aws/bedrock.py:777 — AwsBedrock._parse_provider_response has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base._handle_agent_exception (cognitive 20) · ×1
  • base._handle_agent_exception (cognitive 20) REDACTED:98 — base._handle_agent_exception has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 1 (4 pts), loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemini.get_client (cognitive 20) · ×1
  • Gemini.get_client (cognitive 20) libs/agno/agno/models/google/gemini.py:172 — Gemini.get_client has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.media_to_content_item (cognitive 20) · ×1
  • utils.media_to_content_item (cognitive 20) libs/agno/agno/models/google/utils.py:54 — utils.media_to_content_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, error handling 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WatsonX.parse_tool_calls (cognitive 20) · ×1
  • WatsonX.parse_tool_calls (cognitive 20) libs/agno/agno/models/ibm/watsonx.py:312 — WatsonX.parse_tool_calls has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._warn_on_foreign_studio_registries (cognitive 20) · ×1
  • AgentOS._warn_on_foreign_studio_registries (cognitive 20) libs/agno/agno/os/app.py:1571 — AgentOS._warn_on_foreign_studio_registries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryEventStream.tail (cognitive 20) · ×1
  • InMemoryEventStream.tail (cognitive 20) libs/agno/agno/os/event_streams/in_memory.py:156 — InMemoryEventStream.tail has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HITLHandler.handle_check_status (cognitive 20) · ×1
  • HITLHandler.handle_check_status (cognitive 20) libs/agno/agno/os/interfaces/slack/hitl.py:361 — HITLHandler.handle_check_status has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), loops 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · mcp._require_tool_scopes (cognitive 20) · ×1
  • mcp._require_tool_scopes (cognitive 20) libs/agno/agno/os/mcp.py:876 — mcp._require_tool_scopes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 3, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · mcp._consume_workflow_stream (cognitive 20) · ×1
  • mcp._consume_workflow_stream (cognitive 20) libs/agno/agno/os/mcp.py:1185 — mcp._consume_workflow_stream has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.run_reliability_eval (cognitive 20) · ×1
  • utils.run_reliability_eval (cognitive 20) libs/agno/agno/os/routers/evals/utils.py:179 — utils.run_reliability_eval has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router._list_entries (cognitive 20) · ×1
  • router._list_entries (cognitive 20) libs/agno/agno/os/routers/filesystem/router.py:241 — router._list_entries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router._get_global_files (cognitive 20) · ×1
  • router._get_global_files (cognitive 20) libs/agno/agno/os/routers/filesystem/router.py:324 — router._get_global_files has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunRequirement.provide_user_input (cognitive 20) · ×1
  • RunRequirement.provide_user_input (cognitive 20) libs/agno/agno/run/requirement.py:125 — RunRequirement.provide_user_input has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · status_persist.persist_worker_owned_run (cognitive 20) · ×1
  • status_persist.persist_worker_owned_run (cognitive 20) libs/agno/agno/run/status_persist.py:337 — status_persist.persist_worker_owned_run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _init.__init__ (cognitive 20) · ×1
  • _init.__init__ (cognitive 20) libs/agno/agno/team/_init.py:67 — _init.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _init._bind_member_result_store (cognitive 20) · ×1
  • _init._bind_member_result_store (cognitive 20) libs/agno/agno/team/_init.py:605 — _init._bind_member_result_store has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run.arun_dispatch (cognitive 20) · ×1
  • _run.arun_dispatch (cognitive 20) libs/agno/agno/team/_run.py:4131 — _run.arun_dispatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · team.get_team_by_id (cognitive 20) · ×1
  • team.get_team_by_id (cognitive 20) libs/agno/agno/team/team.py:1886 — team.get_team_by_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (4 pts), error handling 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · KernelSession._evict_loop (cognitive 20) · ×1
  • KernelSession._evict_loop (cognitive 20) libs/agno/agno/tools/code/kernel.py:510 — KernelSession._evict_loop has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodingTools.grep (cognitive 20) · ×1
  • CodingTools.grep (cognitive 20) libs/agno/agno/tools/coding.py:672 — CodingTools.grep has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), error handling 3, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CodingTools.find (cognitive 20) · ×1
  • CodingTools.find (cognitive 20) libs/agno/agno/tools/coding.py:762 — CodingTools.find has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryTools.__init__ (cognitive 20) · ×1
  • MemoryTools.__init__ (cognitive 20) libs/agno/agno/tools/memory.py:14 — MemoryTools.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RedmineTools.update_issue (cognitive 20) · ×1
  • RedmineTools.update_issue (cognitive 20) libs/agno/agno/tools/redmine.py:198 — RedmineTools.update_issue has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (19 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StudioTools.validate_component (cognitive 20) · ×1
  • StudioTools.validate_component (cognitive 20) libs/agno/agno/tools/studio.py:3670 — StudioTools.validate_component has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TrafilaturaTools.crawl_website (cognitive 20) · ×1
  • TrafilaturaTools.crawl_website (cognitive 20) libs/agno/agno/tools/trafilatura.py:232 — TrafilaturaTools.crawl_website has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (4 pts), ternaries 4, loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · YouTools.you_search (cognitive 20) · ×1
  • YouTools.you_search (cognitive 20) libs/agno/agno/tools/youcom.py:122 — YouTools.you_search has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (17 pts), error handling 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · schema.annotation_reaches (cognitive 20) · ×1
  • schema.annotation_reaches (cognitive 20) libs/agno/agno/utils/schema.py:90 — schema.annotation_reaches has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PineconeDb.update_metadata (cognitive 20) · ×1
  • PineconeDb.update_metadata (cognitive 20) REDACTED:793 — PineconeDb.update_metadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3, boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qdrant.insert (cognitive 20) · ×1
  • Qdrant.insert (cognitive 20) REDACTED:370 — Qdrant.insert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.get_workflow_by_id (cognitive 20) · ×1
  • workflow.get_workflow_by_id (cognitive 20) libs/agno/agno/workflow/workflow.py:11917 — workflow.get_workflow_by_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (4 pts), error handling 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GlueCrawler.get_glue_crawler_targets (cognitive 20) · ×1
  • GlueCrawler.get_glue_crawler_targets (cognitive 20) libs/agno_infra/agno/aws/resource/glue/crawler.py:82 — GlueCrawler.get_glue_crawler_targets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reader.read_secrets (cognitive 20) · ×1
  • reader.read_secrets (cognitive 20) libs/agno_infra/agno/aws/resource/secret/reader.py:7 — reader.read_secrets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · InfraSettings._validate_and_set_keys (cognitive 20) · ×1
  • InfraSettings._validate_and_set_keys (cognitive 20) libs/agno_infra/agno/infra/settings.py:108 — InfraSettings._validate_and_set_keys has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (20 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · connect._mint (cognitive 20) · ×1
  • connect._mint (cognitive 20) libs/agnoctl/agnoctl/commands/connect.py:207 — connect._mint has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 1, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowWebSocketClient.run_interactive (cognitive 20) · ×1
  • WorkflowWebSocketClient.run_interactive (cognitive 20) cookbook/04_workflows/06_advanced_concepts/background_execution/websocket_client.py:344 — WorkflowWebSocketClient.run_interactive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 01_error_retry_skip.main (cognitive 20) · ×1
  • 01_error_retry_skip.main (cognitive 20) cookbook/04_workflows/08_human_in_the_loop/error/01_error_retry_skip.py:77 — 01_error_retry_skip.main has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), ternaries 2 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · basic.krippendorff_alpha (cognitive 20) · ×1
  • basic.krippendorff_alpha (cognitive 20) cookbook/data_labeling/_19_inter_annotator_agreement/basic.py:164 — basic.krippendorff_alpha has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jury_votes.krippendorff_alpha (cognitive 20) · ×1
  • jury_votes.krippendorff_alpha (cognitive 20) cookbook/data_labeling/_19_inter_annotator_agreement/jury_votes.py:199 — jury_votes.krippendorff_alpha has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools.determine_tools_for_model (cognitive 19) · ×1
  • _tools.determine_tools_for_model (cognitive 19) libs/agno/agno/agent/_tools.py:652 — _tools.determine_tools_for_model has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools.handle_tool_call_updates (cognitive 19) · ×1
  • _tools.handle_tool_call_updates (cognitive 19) libs/agno/agno/agent/_tools.py:1076 — _tools.handle_tool_call_updates has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_tools.handle_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _tools.handle_tool_call_updates_stream (cognitive 19) · ×1
  • _tools.handle_tool_call_updates_stream (cognitive 19) libs/agno/agno/agent/_tools.py:1124 — _tools.handle_tool_call_updates_stream has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (_tools.handle_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · BaseExternalAgent._apersist_run_in_session (cognitive 19) · ×1
  • BaseExternalAgent._apersist_run_in_session (cognitive 19) libs/agno/agno/agents/base.py:807 — BaseExternalAgent._apersist_run_in_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · base.session_branch (cognitive 19) · ×1
  • base.session_branch (cognitive 19) libs/agno/agno/agents/base.py:169 — base.session_branch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, ternaries 1 (3 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _TelemetryDispatcher.close (cognitive 19) · ×1
  • _TelemetryDispatcher.close (cognitive 19) libs/agno/agno/api/api.py:132 — _TelemetryDispatcher.close has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, error handling 2 (3 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · A2AClient._parse_task_result (cognitive 19) · ×1
  • A2AClient._parse_task_result (cognitive 19) libs/agno/agno/client/a2a/client.py:178 — A2AClient._parse_task_result has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (5 pts), ternaries 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParallelMCPBackend._pages_from_fetch_payload (cognitive 19) · ×1
  • ParallelMCPBackend._pages_from_fetch_payload (cognitive 19) libs/agno/agno/context/web/parallel_mcp.py:145 — ParallelMCPBackend._pages_from_fetch_payload has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_metrics (cognitive 19) · ×1
  • DynamoDb.get_metrics (cognitive 19) libs/agno/agno/db/dynamo/dynamo.py:1965 — DynamoDb.get_metrics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb.get_runs (cognitive 19) · ×1
  • FirestoreDb.get_runs (cognitive 19) libs/agno/agno/db/firestore/firestore.py:413 — FirestoreDb.get_runs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FirestoreDb.upsert_session (cognitive 19) · ×1
  • FirestoreDb.upsert_session (cognitive 19) libs/agno/agno/db/firestore/firestore.py:956 — FirestoreDb.upsert_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MySQLDb.get_runs (cognitive 19) · ×1
  • MySQLDb.get_runs (cognitive 19) libs/agno/agno/db/mysql/mysql.py:724 — MySQLDb.get_runs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncPostgresDb.get_traces (cognitive 19) · ×1
  • AsyncPostgresDb.get_traces (cognitive 19) libs/agno/agno/db/postgres/async_postgres.py:3403 — AsyncPostgresDb.get_traces has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 3 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PostgresDb.get_runs (cognitive 19) · ×1
  • PostgresDb.get_runs (cognitive 19) libs/agno/agno/db/postgres/postgres.py:1204 — PostgresDb.get_runs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PostgresDb.get_traces (cognitive 19) · ×1
  • PostgresDb.get_traces (cognitive 19) libs/agno/agno/db/postgres/postgres.py:3946 — PostgresDb.get_traces has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 3 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RedisDb._get_all_sessions_for_metrics_calculation (cognitive 19) · ×1
  • RedisDb._get_all_sessions_for_metrics_calculation (cognitive 19) libs/agno/agno/db/redis/redis.py:1361 — RedisDb._get_all_sessions_for_metrics_calculation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStoreDb.get_runs (cognitive 19) · ×1
  • SingleStoreDb.get_runs (cognitive 19) libs/agno/agno/db/singlestore/singlestore.py:783 — SingleStoreDb.get_runs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncSqliteDb.get_user_memories (cognitive 19) · ×1
  • AsyncSqliteDb.get_user_memories (cognitive 19) REDACTED:2209 — AsyncSqliteDb.get_user_memories has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncSqliteDb.get_traces (cognitive 19) · ×1
  • AsyncSqliteDb.get_traces (cognitive 19) REDACTED:3549 — AsyncSqliteDb.get_traces has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 3 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SqliteDb.get_traces (cognitive 19) · ×1
  • SqliteDb.get_traces (cognitive 19) REDACTED:3743 — SqliteDb.get_traces has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 3 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AgentAsJudgeEval.arun (cognitive 19) · ×1
  • AgentAsJudgeEval.arun (cognitive 19) libs/agno/agno/eval/agent_as_judge.py:580 — AgentAsJudgeEval.arun has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DbFileSystem.__init__ (cognitive 19) · ×1
  • DbFileSystem.__init__ (cognitive 19) REDACTED:76 — DbFileSystem.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileSystem.from_dict (cognitive 19) · ×1
  • FileSystem.from_dict (cognitive 19) libs/agno/agno/fs/fs.py:335 — FileSystem.from_dict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AwsBedrockEmbedder._extract_embeddings (cognitive 19) · ×1
  • AwsBedrockEmbedder._extract_embeddings (cognitive 19) libs/agno/agno/knowledge/embedder/aws_bedrock.py:293 — AwsBedrockEmbedder._extract_embeddings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge.ainsert_many (cognitive 19) · ×1
  • Knowledge.ainsert_many (cognitive 19) libs/agno/agno/knowledge/knowledge.py:875 — Knowledge.ainsert_many has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 5 (7 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge.insert_many) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge.insert_many (cognitive 19) · ×1
  • Knowledge.insert_many (cognitive 19) libs/agno/agno/knowledge/knowledge.py:1022 — Knowledge.insert_many has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 5 (7 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Knowledge.ainsert_many) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Knowledge._build_remote_content_identity (cognitive 19) · ×1
  • Knowledge._build_remote_content_identity (cognitive 19) libs/agno/agno/knowledge/knowledge.py:4137 — Knowledge._build_remote_content_identity has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, ternaries 3 (6 pts), if/else 2 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · _commands._execute_command (cognitive 19) · ×1
  • _commands._execute_command (cognitive 19) libs/agno/agno/knowledge/page/_commands.py:685 — _commands._execute_command has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (4 pts), error handling 3, loops 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · S3Config._process_list_response (cognitive 19) · ×1
  • S3Config._process_list_response (cognitive 19) libs/agno/agno/knowledge/remote_content/s3.py:113 — S3Config._process_list_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DecisionLogStore.build_context (cognitive 19) · ×1
  • DecisionLogStore.build_context (cognitive 19) libs/agno/agno/learn/stores/decision_log.py:147 — DecisionLogStore.build_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore._apply_forget (cognitive 19) · ×1
  • EntityMemoryStore._apply_forget (cognitive 19) libs/agno/agno/learn/stores/entity_memory.py:2155 — EntityMemoryStore._apply_forget has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, loops 1 (2 pts), ternaries 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EntityMemoryStore._aname_candidates (cognitive 19) · ×1
  • EntityMemoryStore._aname_candidates (cognitive 19) libs/agno/agno/learn/stores/entity_memory.py:2656 — EntityMemoryStore._aname_candidates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (6 pts), loops 2 (3 pts), boolean chains 1, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore.alist_entities (cognitive 19) · ×1
  • EntityMemoryStore.alist_entities (cognitive 19) libs/agno/agno/learn/stores/entity_memory.py:3008 — EntityMemoryStore.alist_entities has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (6 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LearnedKnowledgeStore.print (cognitive 19) · ×1
  • LearnedKnowledgeStore.print (cognitive 19) libs/agno/agno/learn/stores/learned_knowledge.py:1496 — LearnedKnowledgeStore.print has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.build_learning_id (cognitive 19) · ×1
  • utils.build_learning_id (cognitive 19) libs/agno/agno/learn/utils.py:41 — utils.build_learning_id has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Claude.get_request_params (cognitive 19) · ×1
  • Claude.get_request_params (cognitive 19) libs/agno/agno/models/anthropic/claude.py:542 — Claude.get_request_params has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Model._ainvoke_stream_with_retry (cognitive 19) · ×1
  • Model._ainvoke_stream_with_retry (cognitive 19) REDACTED:375 — Model._ainvoke_stream_with_retry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), error handling 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runs.offload_run_for_storage (cognitive 19) · ×1
  • runs.offload_run_for_storage (cognitive 19) libs/agno/agno/offload/runs.py:29 — runs.offload_run_for_storage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (runs.aoffload_run_for_storage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · runs.aoffload_run_for_storage (cognitive 19) · ×1
  • runs.aoffload_run_for_storage (cognitive 19) libs/agno/agno/offload/runs.py:102 — runs.aoffload_run_for_storage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (runs.offload_run_for_storage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AgentOS._setup_tracing (cognitive 19) · ×1
  • AgentOS._setup_tracing (cognitive 19) libs/agno/agno/os/app.py:1713 — AgentOS._setup_tracing has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handlers.on_run_completed (cognitive 19) · ×1
  • handlers.on_run_completed (cognitive 19) libs/agno/agno/os/interfaces/agui/handlers.py:368 — handlers.on_run_completed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.run_entity (cognitive 19) · ×1
  • router.run_entity (cognitive 19) libs/agno/agno/os/interfaces/agui/router.py:40 — router.run_entity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · formatting._merge_blockquote_lines (cognitive 19) · ×1
  • formatting._merge_blockquote_lines (cognitive 19) libs/agno/agno/os/interfaces/telegram/formatting.py:130 — formatting._merge_blockquote_lines has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · job_queue.resolve_queue_scope (cognitive 19) · ×1
  • job_queue.resolve_queue_scope (cognitive 19) libs/agno/agno/os/job_queue.py:452 — job_queue.resolve_queue_scope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp._split_tool_entries (cognitive 19) · ×1
  • mcp._split_tool_entries (cognitive 19) libs/agno/agno/os/mcp.py:1717 — mcp._split_tool_entries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.agent_resumable_response_streamer (cognitive 19) · ×1
  • router.agent_resumable_response_streamer (cognitive 19) libs/agno/agno/os/routers/agents/router.py:194 — router.agent_resumable_response_streamer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 3, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · components._validate_pinned_versions_readable (cognitive 19) · ×1
  • components._validate_pinned_versions_readable (cognitive 19) libs/agno/agno/os/routers/components/components.py:347 — components._validate_pinned_versions_readable has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router._resolve_filesystem (cognitive 19) · ×1
  • router._resolve_filesystem (cognitive 19) libs/agno/agno/os/routers/filesystem/router.py:143 — router._resolve_filesystem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router._get_global_filesystem_agent_ids (cognitive 19) · ×1
  • router._get_global_filesystem_agent_ids (cognitive 19) libs/agno/agno/os/routers/filesystem/router.py:283 — router._get_global_filesystem_agent_ids has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.resolve_ws_deployment_scope_config (cognitive 19) · ×1
  • utils.resolve_ws_deployment_scope_config (cognitive 19) libs/agno/agno/os/utils.py:2005 — utils.resolve_ws_deployment_scope_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, ternaries 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · concurrency.background_run_slot (cognitive 19) · ×1
  • concurrency.background_run_slot (cognitive 19) libs/agno/agno/run/concurrency.py:74 — concurrency.background_run_slot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _response.get_response_format (cognitive 19) · ×1
  • _response.get_response_format (cognitive 19) libs/agno/agno/team/_response.py:81 — _response.get_response_format has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _session._scrub_tool_results_keeping_unresolved (cognitive 19) · ×1
  • _session._scrub_tool_results_keeping_unresolved (cognitive 19) libs/agno/agno/team/_session.py:178 — _session._scrub_tool_results_keeping_unresolved has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TaskList.get_summary_string (cognitive 19) · ×1
  • TaskList.get_summary_string (cognitive 19) libs/agno/agno/team/task.py:150 — TaskList.get_summary_string has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (5 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityTools._load_agent_directory (cognitive 19) · ×1
  • AntigravityTools._load_agent_directory (cognitive 19) libs/agno/agno/tools/antigravity.py:140 — AntigravityTools._load_agent_directory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxTools.generate_video (cognitive 19) · ×1
  • MiniMaxTools.generate_video (cognitive 19) libs/agno/agno/tools/minimax.py:72 — MiniMaxTools.generate_video has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (MiniMaxTools.agenerate_video) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · MiniMaxTools.agenerate_video (cognitive 19) · ×1
  • MiniMaxTools.agenerate_video (cognitive 19) libs/agno/agno/tools/minimax.py:158 — MiniMaxTools.agenerate_video has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (MiniMaxTools.generate_video) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · OpenCVTools.capture_image (cognitive 19) · ×1
  • OpenCVTools.capture_image (cognitive 19) libs/agno/agno/tools/opencv.py:43 — OpenCVTools.capture_image has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioRunnerTools._require_registry_for (cognitive 19) · ×1
  • StudioRunnerTools._require_registry_for (cognitive 19) libs/agno/agno/tools/studio_runner.py:1091 — StudioRunnerTools._require_registry_for has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VisualizationTools.create_scatter_plot (cognitive 19) · ×1
  • VisualizationTools.create_scatter_plot (cognitive 19) libs/agno/agno/tools/visualization.py:305 — VisualizationTools.create_scatter_plot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.scrub_tool_results_from_run_output (cognitive 19) · ×1
  • agent.scrub_tool_results_from_run_output (cognitive 19) libs/agno/agno/utils/agent.py:575 — agent.scrub_tool_results_from_run_output has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.validate_input (cognitive 19) · ×1
  • agent.validate_input (cognitive 19) libs/agno/agno/utils/agent.py:1349 — agent.validate_input has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 3 (7 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · message.safe_truncation_index (cognitive 19) · ×1
  • message.safe_truncation_index (cognitive 19) libs/agno/agno/utils/message.py:32 — message.safe_truncation_index has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · response.get_paused_content (cognitive 19) · ×1
  • response.get_paused_content (cognitive 19) libs/agno/agno/utils/response.py:120 — response.get_paused_content has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 8, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Milvus.upsert (cognitive 19) · ×1
  • Milvus.upsert (cognitive 19) REDACTED:705 — Milvus.upsert has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (6 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.adelete_session (cognitive 19) · ×1
  • Workflow.adelete_session (cognitive 19) libs/agno/agno/workflow/workflow.py:1130 — Workflow.adelete_session has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.run (cognitive 19) · ×1
  • Workflow.run (cognitive 19) libs/agno/agno/workflow/workflow.py:10577 — Workflow.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CacheCluster.get_cache_endpoint (cognitive 19) · ×1
  • CacheCluster.get_cache_endpoint (cognitive 19) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:405 — CacheCluster.get_cache_endpoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), boolean chains 3, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CacheCluster.get_cache_port) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CacheCluster.get_cache_port (cognitive 19) · ×1
  • CacheCluster.get_cache_port (cognitive 19) libs/agno_infra/agno/aws/resource/elasticache/cluster.py:435 — CacheCluster.get_cache_port has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), boolean chains 3, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CacheCluster.get_cache_endpoint) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · InfraResource.get_input_file_path (cognitive 19) · ×1
  • InfraResource.get_input_file_path (cognitive 19) libs/agno_infra/agno/base/resource.py:56 — InfraResource.get_input_file_path has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (19 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (InfraResource.get_output_file_path) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · InfraResource.get_output_file_path (cognitive 19) · ×1
  • InfraResource.get_output_file_path (cognitive 19) libs/agno_infra/agno/base/resource.py:76 — InfraResource.get_output_file_path has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (19 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (InfraResource.get_input_file_path) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · DockerImage.buildx (cognitive 19) · ×1
  • DockerImage.buildx (cognitive 19) libs/agno_infra/agno/docker/resource/image.py:91 — DockerImage.buildx has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · check_style.check_style (cognitive 19) · ×1
  • check_style.check_style (cognitive 19) cookbook/02_agents/16_skills/sample_skills/code-review/scripts/check_style.py:16 — check_style.check_style has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowWebSocketClient.listen_for_events (cognitive 19) · ×1
  • WorkflowWebSocketClient.listen_for_events (cognitive 19) cookbook/04_workflows/06_advanced_concepts/background_execution/websocket_client.py:250 — WorkflowWebSocketClient.listen_for_events has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 3 (4 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · step_history.analyze_food_preferences (cognitive 19) · ×1
  • step_history.analyze_food_preferences (cognitive 19) cookbook/04_workflows/06_advanced_concepts/history/step_history.py:44 — step_history.analyze_food_preferences has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 6, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · 03_step_confirmation_streaming.process_event_stream (cognitive 19) · ×1
  • 03_step_confirmation_streaming.process_event_stream (cognitive 19) cookbook/04_workflows/08_human_in_the_loop/confirmation/03_step_confirmation_streaming.py:100 — 03_step_confirmation_streaming.process_event_stream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectNotesStore.print (cognitive 19) · ×1
  • ProjectNotesStore.print (cognitive 19) cookbook/08_learning/08_custom_stores/02_custom_store_with_db.py:304 — ProjectNotesStore.print has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (9 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cookbook_runner.main (cognitive 19) · ×1
  • cookbook_runner.main (cognitive 19) cookbook/scripts/cookbook_runner.py:205 — cookbook_runner.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (6 pts), boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._plan_overflow_fold (cognitive 18) · ×1
  • _messages._plan_overflow_fold (cognitive 18) libs/agno/agno/agent/_messages.py:497 — _messages._plan_overflow_fold has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _run.run_dispatch (cognitive 18) · ×1
  • _run.run_dispatch (cognitive 18) libs/agno/agno/agent/_run.py:1321 — _run.run_dispatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _tools.raise_if_async_tools (cognitive 18) · ×1
  • _tools.raise_if_async_tools (cognitive 18) libs/agno/agno/agent/_tools.py:73 — _tools.raise_if_async_tools has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent.get_agent_by_id (cognitive 18) · ×1
  • agent.get_agent_by_id (cognitive 18) libs/agno/agno/agent/agent.py:1859 — agent.get_agent_by_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (3 pts), boolean chains 2, error handling 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · execution._cancel_ticketless_pending_run (cognitive 18) · ×1
  • execution._cancel_ticketless_pending_run (cognitive 18) libs/agno/agno/company/execution.py:221 — execution._cancel_ticketless_pending_run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GitBackend.setup (cognitive 18) · ×1
  • GitBackend.setup (cognitive 18) REDACTED:296 — GitBackend.setup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.create_spans (cognitive 18) · ×1
  • DynamoDb.create_spans (cognitive 18) libs/agno/agno/db/dynamo/dynamo.py:3043 — DynamoDb.create_spans has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb.cleanup_legacy_runs_field (cognitive 18) · ×1
  • FirestoreDb.cleanup_legacy_runs_field (cognitive 18) libs/agno/agno/db/firestore/firestore.py:249 — FirestoreDb.cleanup_legacy_runs_field has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils._create_composite_indexes (cognitive 18) · ×1
  • utils._create_composite_indexes (cognitive 18) libs/agno/agno/db/firestore/utils.py:48 — utils._create_composite_indexes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (5 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.get_metrics (cognitive 18) · ×1
  • GcsJsonDb.get_metrics (cognitive 18) libs/agno/agno/db/gcs_json/gcs_json_db.py:1229 — GcsJsonDb.get_metrics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.get_metrics (cognitive 18) · ×1
  • InMemoryDb.get_metrics (cognitive 18) libs/agno/agno/db/in_memory/in_memory_db.py:1048 — InMemoryDb.get_metrics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, error handling 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_metrics (cognitive 18) · ×1
  • JsonDb.get_metrics (cognitive 18) libs/agno/agno/db/json/json_db.py:1298 — JsonDb.get_metrics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._revert_mysql_like_user_id (cognitive 18) · ×1
  • v3_0_0._revert_mysql_like_user_id (cognitive 18) REDACTED:4154 — v3_0_0._revert_mysql_like_user_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._revert_async_mysql_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · v3_0_0._revert_async_mysql_user_id (cognitive 18) · ×1
  • v3_0_0._revert_async_mysql_user_id (cognitive 18) REDACTED:4220 — v3_0_0._revert_async_mysql_user_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._revert_mysql_like_user_id) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsyncMongoDb._get_all_sessions_for_metrics_calculation (cognitive 18) · ×1
  • AsyncMongoDb._get_all_sessions_for_metrics_calculation (cognitive 18) libs/agno/agno/db/mongo/async_mongo.py:1863 — AsyncMongoDb._get_all_sessions_for_metrics_calculation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb._get_all_sessions_for_metrics_calculation (cognitive 18) · ×1
  • MongoDb._get_all_sessions_for_metrics_calculation (cognitive 18) libs/agno/agno/db/mongo/mongo.py:1668 — MongoDb._get_all_sessions_for_metrics_calculation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.create_collection_indexes (cognitive 18) · ×1
  • utils.create_collection_indexes (cognitive 18) libs/agno/agno/db/mongo/utils.py:28 — utils.create_collection_indexes has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (7 pts), if/else 4 (7 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (utils.create_collection_indexes_async) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · utils.create_collection_indexes_async (cognitive 18) · ×1
  • utils.create_collection_indexes_async (cognitive 18) libs/agno/agno/db/mongo/utils.py:73 — utils.create_collection_indexes_async has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (7 pts), if/else 4 (7 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (utils.create_collection_indexes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsyncMySQLDb._ascrub_run_ids_from_legacy_blob (cognitive 18) · ×1
  • AsyncMySQLDb._ascrub_run_ids_from_legacy_blob (cognitive 18) libs/agno/agno/db/mysql/async_mysql.py:794 — AsyncMySQLDb._ascrub_run_ids_from_legacy_blob has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MySQLDb._scrub_run_ids_from_legacy_blob (cognitive 18) · ×1
  • MySQLDb._scrub_run_ids_from_legacy_blob (cognitive 18) libs/agno/agno/db/mysql/mysql.py:785 — MySQLDb._scrub_run_ids_from_legacy_blob has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MySQLDb.get_user_memories (cognitive 18) · ×1
  • MySQLDb.get_user_memories (cognitive 18) libs/agno/agno/db/mysql/mysql.py:1670 — MySQLDb.get_user_memories has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncPostgresDb.enqueue_job (cognitive 18) · ×1
  • AsyncPostgresDb.enqueue_job (cognitive 18) libs/agno/agno/db/postgres/async_postgres.py:5092 — AsyncPostgresDb.enqueue_job has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.get_user_memories (cognitive 18) · ×1
  • PostgresDb.get_user_memories (cognitive 18) libs/agno/agno/db/postgres/postgres.py:2545 — PostgresDb.get_user_memories has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PostgresDb.enqueue_job (cognitive 18) · ×1
  • PostgresDb.enqueue_job (cognitive 18) libs/agno/agno/db/postgres/postgres.py:7796 — PostgresDb.enqueue_job has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedisDb._q_try_claim (cognitive 18) · ×1
  • RedisDb._q_try_claim (cognitive 18) libs/agno/agno/db/redis/redis.py:2738 — RedisDb._q_try_claim has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStoreDb._scrub_run_ids_from_legacy_blob (cognitive 18) · ×1
  • SingleStoreDb._scrub_run_ids_from_legacy_blob (cognitive 18) libs/agno/agno/db/singlestore/singlestore.py:841 — SingleStoreDb._scrub_run_ids_from_legacy_blob has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStoreDb.get_user_memories (cognitive 18) · ×1
  • SingleStoreDb.get_user_memories (cognitive 18) libs/agno/agno/db/singlestore/singlestore.py:1709 — SingleStoreDb.get_user_memories has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AsyncSqliteDb._ascrub_run_ids_from_legacy_blob (cognitive 18) · ×1
  • AsyncSqliteDb._ascrub_run_ids_from_legacy_blob (cognitive 18) REDACTED:1092 — AsyncSqliteDb._ascrub_run_ids_from_legacy_blob has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb._scrub_run_ids_from_legacy_blob (cognitive 18) · ×1
  • SqliteDb._scrub_run_ids_from_legacy_blob (cognitive 18) REDACTED:1276 — SqliteDb._scrub_run_ids_from_legacy_blob has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.get_user_memories (cognitive 18) · ×1
  • SqliteDb.get_user_memories (cognitive 18) REDACTED:2466 — SqliteDb.get_user_memories has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SurrealDb.calculate_metrics (cognitive 18) · ×1
  • SurrealDb.calculate_metrics (cognitive 18) libs/agno/agno/db/surrealdb/surrealdb.py:1346 — SurrealDb.calculate_metrics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValkeyDb._get_span_stats_for_trace (cognitive 18) · ×1
  • ValkeyDb._get_span_stats_for_trace (cognitive 18) libs/agno/agno/db/valkey/valkey.py:2501 — ValkeyDb._get_span_stats_for_trace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (6 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveGrid._refresh (cognitive 18) · ×1
  • LiveGrid._refresh (cognitive 18) libs/agno/agno/environments/_render.py:181 — LiveGrid._refresh has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownChunking._split_by_headings (cognitive 18) · ×1
  • MarkdownChunking._split_by_headings (cognitive 18) libs/agno/agno/knowledge/chunking/markdown.py:137 — MarkdownChunking._split_by_headings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · page._sections (cognitive 18) · ×1
  • page._sections (cognitive 18) libs/agno/agno/knowledge/chunking/page.py:74 — page._sections has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (7 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SharePointLoader._aload_from_sharepoint (cognitive 18) · ×1
  • SharePointLoader._aload_from_sharepoint (cognitive 18) libs/agno/agno/knowledge/loaders/sharepoint.py:210 — SharePointLoader._aload_from_sharepoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SharePointLoader._load_from_sharepoint) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SharePointLoader._load_from_sharepoint (cognitive 18) · ×1
  • SharePointLoader._load_from_sharepoint (cognitive 18) libs/agno/agno/knowledge/loaders/sharepoint.py:329 — SharePointLoader._load_from_sharepoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SharePointLoader._aload_from_sharepoint) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · LearningMachine._serialize_store_input (cognitive 18) · ×1
  • LearningMachine._serialize_store_input (cognitive 18) libs/agno/agno/learn/machine.py:1084 — LearningMachine._serialize_store_input has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore._related_names (cognitive 18) · ×1
  • EntityMemoryStore._related_names (cognitive 18) libs/agno/agno/learn/stores/entity_memory.py:620 — EntityMemoryStore._related_names has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (EntityMemoryStore._arelated_names) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · EntityMemoryStore._arelated_names (cognitive 18) · ×1
  • EntityMemoryStore._arelated_names (cognitive 18) libs/agno/agno/learn/stores/entity_memory.py:652 — EntityMemoryStore._arelated_names has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (EntityMemoryStore._related_names) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Model._populate_assistant_message_from_stream_data (cognitive 18) · ×1
  • Model._populate_assistant_message_from_stream_data (cognitive 18) REDACTED:1894 — Model._populate_assistant_message_from_stream_data has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Cerebras._ensure_additional_properties_false (cognitive 18) · ×1
  • Cerebras._ensure_additional_properties_false (cognitive 18) libs/agno/agno/models/cerebras/cerebras.py:99 — Cerebras._ensure_additional_properties_false has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 6 (7 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cerebras.get_request_params (cognitive 18) · ×1
  • Cerebras.get_request_params (cognitive 18) libs/agno/agno/models/cerebras/cerebras.py:174 — Cerebras.get_request_params has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIChat.invoke_stream (cognitive 18) · ×1
  • OpenAIChat.invoke_stream (cognitive 18) libs/agno/agno/models/openai/chat.py:573 — OpenAIChat.invoke_stream has cognitive complexity 18 (threshold 15). Drivers by points: error handling 7 (9 pts), ternaries 3 (6 pts), if/else 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIChat.ainvoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · OpenAIChat.ainvoke_stream (cognitive 18) · ×1
  • OpenAIChat.ainvoke_stream (cognitive 18) libs/agno/agno/models/openai/chat.py:660 — OpenAIChat.ainvoke_stream has cognitive complexity 18 (threshold 15). Drivers by points: error handling 7 (9 pts), ternaries 3 (6 pts), if/else 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIChat.invoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · OpenAIResponses._format_file_for_input (cognitive 18) · ×1
  • OpenAIResponses._format_file_for_input (cognitive 18) libs/agno/agno/models/openai/responses.py:481 — OpenAIResponses._format_file_for_input has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._add_built_in_routes (cognitive 18) · ×1
  • AgentOS._add_built_in_routes (cognitive 18) libs/agno/agno/os/app.py:1076 — AgentOS._add_built_in_routes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._seed_authorization_provider (cognitive 18) · ×1
  • AgentOS._seed_authorization_provider (cognitive 18) libs/agno/agno/os/app.py:2485 — AgentOS._seed_authorization_provider has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._get_knowledge_config (cognitive 18) · ×1
  • AgentOS._get_knowledge_config (cognitive 18) libs/agno/agno/os/app.py:3107 — AgentOS._get_knowledge_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp._register_custom_tool (cognitive 18) · ×1
  • mcp._register_custom_tool (cognitive 18) libs/agno/agno/os/mcp.py:560 — mcp._register_custom_tool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (7 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scopes.has_required_scopes (cognitive 18) · ×1
  • scopes.has_required_scopes (cognitive 18) libs/agno/agno/os/scopes.py:263 — scopes.has_required_scopes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.resolve_ws_jwt_config (cognitive 18) · ×1
  • utils.resolve_ws_jwt_config (cognitive 18) libs/agno/agno/os/utils.py:2051 — utils.resolve_ws_jwt_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.collect_components_from_os (cognitive 18) · ×1
  • utils.collect_components_from_os (cognitive 18) libs/agno/agno/os/utils.py:2621 — utils.collect_components_from_os has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 3 (6 pts), boolean chains 3, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils._get_python_type_from_json_schema (cognitive 18) · ×1
  • utils._get_python_type_from_json_schema (cognitive 18) libs/agno/agno/os/utils.py:2662 — utils._get_python_type_from_json_schema has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowSession.get_workflow_history (cognitive 18) · ×1
  • WorkflowSession.get_workflow_history (cognitive 18) libs/agno/agno/session/workflow.py:162 — WorkflowSession.get_workflow_history has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (6 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _init.initialize_team (cognitive 18) · ×1
  • _init.initialize_team (cognitive 18) libs/agno/agno/team/_init.py:856 — _init.initialize_team has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · _messages._get_tool_names (cognitive 18) · ×1
  • _messages._get_tool_names (cognitive 18) libs/agno/agno/team/_messages.py:77 — _messages._get_tool_names has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · annotations.validate_tool_annotations (cognitive 18) · ×1
  • annotations.validate_tool_annotations (cognitive 18) libs/agno/agno/tools/annotations.py:32 — annotations.validate_tool_annotations has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CalComTools.__init__ (cognitive 18) · ×1
  • CalComTools.__init__ (cognitive 18) libs/agno/agno/tools/calcom.py:16 — CalComTools.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodingTools.__init__ (cognitive 18) · ×1
  • CodingTools.__init__ (cognitive 18) libs/agno/agno/tools/coding.py:140 — CodingTools.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FalTools.generate_media (cognitive 18) · ×1
  • FalTools.generate_media (cognitive 18) libs/agno/agno/tools/fal.py:54 — FalTools.generate_media has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileTools.__init__ (cognitive 18) · ×1
  • FileTools.__init__ (cognitive 18) libs/agno/agno/tools/file/file.py:95 — FileTools.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 8, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · YFinance.get_earnings (cognitive 18) · ×1
  • YFinance.get_earnings (cognitive 18) libs/agno/agno/tools/finance/providers/yfinance.py:402 — YFinance.get_earnings has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (6 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 2, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · yfinance._news_item (cognitive 18) · ×1
  • yfinance._news_item (cognitive 18) libs/agno/agno/tools/finance/providers/yfinance.py:577 — yfinance._news_item has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Function._cached_value (cognitive 18) · ×1
  • Function._cached_value (cognitive 18) libs/agno/agno/tools/function.py:2005 — Function._cached_value has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (7 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GmailTools.update_draft (cognitive 18) · ×1
  • GmailTools.update_draft (cognitive 18) libs/agno/agno/tools/google/gmail.py:1683 — GmailTools.update_draft has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (5 pts), if/else 3 (5 pts), ternaries 3 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleSlidesTools.add_table (cognitive 18) · ×1
  • GoogleSlidesTools.add_table (cognitive 18) libs/agno/agno/tools/google/slides.py:664 — GoogleSlidesTools.add_table has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (5 pts), boolean chains 3, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mem0Tools.__init__ (cognitive 18) · ×1
  • Mem0Tools.__init__ (cognitive 18) libs/agno/agno/tools/mem0.py:17 — Mem0Tools.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SmallestTools.get_voices (cognitive 18) · ×1
  • SmallestTools.get_voices (cognitive 18) libs/agno/agno/tools/smallest.py:92 — SmallestTools.get_voices has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._find_tool (cognitive 18) · ×1
  • StudioTools._find_tool (cognitive 18) libs/agno/agno/tools/studio.py:633 — StudioTools._find_tool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · YFinanceTools.__init__ (cognitive 18) · ×1
  • YFinanceTools.__init__ (cognitive 18) libs/agno/agno/tools/yfinance.py:31 — YFinanceTools.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · claude.build_system_blocks (cognitive 18) · ×1
  • claude.build_system_blocks (cognitive 18) libs/agno/agno/utils/models/claude.py:531 — claude.build_system_blocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · claude.format_tools_for_model (cognitive 18) · ×1
  • claude.format_tools_for_model (cognitive 18) libs/agno/agno/utils/models/claude.py:856 — claude.format_tools_for_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · response.create_paused_run_output_panel (cognitive 18) · ×1
  • response.create_paused_run_output_panel (cognitive 18) libs/agno/agno/utils/response.py:81 — response.create_paused_run_output_panel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 3 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · streamlit.display_response (cognitive 18) · ×1
  • streamlit.display_response (cognitive 18) libs/agno/agno/utils/streamlit.py:267 — streamlit.display_response has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, error handling 3 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LanceDb.insert (cognitive 18) · ×1
  • LanceDb.insert (cognitive 18) REDACTED:354 — LanceDb.insert has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PgVector._upsert (cognitive 18) · ×1
  • PgVector._upsert (cognitive 18) REDACTED:590 — PgVector._upsert has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (9 pts), if/else 3 (6 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UpstashVectorDb.search (cognitive 18) · ×1
  • UpstashVectorDb.search (cognitive 18) REDACTED:418 — UpstashVectorDb.search has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ValkeyDb._parse_search_results (cognitive 18) · ×1
  • ValkeyDb._parse_search_results (cognitive 18) libs/agno/agno/vectordb/valkey/valkeydb.py:377 — ValkeyDb._parse_search_results has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 pts), boolean chains 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Condition._update_step_input_from_outputs (cognitive 18) · ×1
  • Condition._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/condition.py:326 — Condition._update_step_input_from_outputs has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Loop._update_step_input_from_outputs (cognitive 18) · ×1
  • Loop._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/loop.py:377 — Loop._update_step_input_from_outputs has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Parallel.execute (cognitive 18) · ×1
  • Parallel.execute (cognitive 18) libs/agno/agno/workflow/parallel.py:309 — Parallel.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (6 pts), loops 3, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router._update_step_input_from_outputs (cognitive 18) · ×1
  • Router._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/router.py:422 — Router._update_step_input_from_outputs has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Steps._update_step_input_from_outputs (cognitive 18) · ×1
  • Steps._update_step_input_from_outputs (cognitive 18) libs/agno/agno/workflow/steps.py:200 — Steps._update_step_input_from_outputs has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · mcp_client._verify_mcp (cognitive 18) · ×1
  • mcp_client._verify_mcp (cognitive 18) libs/agnoctl/agnoctl/mcp_client.py:84 — mcp_client._verify_mcp has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · followup_suggestions_streaming.main (cognitive 18) · ×1
  • followup_suggestions_streaming.main (cognitive 18) cookbook/02_agents/02_input_output/followup_suggestions_streaming.py:40 — followup_suggestions_streaming.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · background_execution_structured.example_multiple_background_runs (cognitive 18) · ×1
  • background_execution_structured.example_multiple_background_runs (cognitive 18) cookbook/02_agents/14_advanced/background_execution_structured.py:118 — background_execution_structured.example_multiple_background_runs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowWebSocketTester._phase2_reconnect (cognitive 18) · ×1
  • WorkflowWebSocketTester._phase2_reconnect (cognitive 18) cookbook/04_workflows/06_advanced_concepts/long_running/websocket_reconnect.py:125 — WorkflowWebSocketTester._phase2_reconnect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2, ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · user_input.provide_values (cognitive 18) · ×1
  • user_input.provide_values (cognitive 18) cookbook/05_agent_os/05_human_in_the_loop/user_input.py:95 — user_input.provide_values has cognitive complexity 18 (threshold 15). Drivers by points: if/else 2 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · studio_hitl_agent.resolve_feedback (cognitive 18) · ×1
  • studio_hitl_agent.resolve_feedback (cognitive 18) cookbook/05_agent_os/22_studio/studio_hitl_agent.py:96 — studio_hitl_agent.resolve_feedback has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · studio_hitl_agent.run_console_demo (cognitive 18) · ×1
  • studio_hitl_agent.run_console_demo (cognitive 18) cookbook/05_agent_os/22_studio/studio_hitl_agent.py:147 — studio_hitl_agent.run_console_demo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jury_calibrated.main (cognitive 18) · ×1
  • jury_calibrated.main (cognitive 18) cookbook/data_labeling/_05_text_pairwise_preference/jury_calibrated.py:201 — jury_calibrated.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · report.render_comparison_table (cognitive 18) · ×1
  • report.render_comparison_table (cognitive 18) cookbook/performance/report.py:487 — report.render_comparison_table has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agno.agnoAGUIAdapter.parse (cognitive 18) · ×1
  • agno.agnoAGUIAdapter.parse (cognitive 18) cookbook/05_agent_os/16_agui/openui/frontend/src/agno.ts:36 — agno.agnoAGUIAdapter.parse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _init.set_filesystem (cognitive 17) · ×1
  • _init.set_filesystem (cognitive 17) libs/agno/agno/agent/_init.py:303 — _init.set_filesystem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _messages._learning_message_text (cognitive 17) · ×1
  • _messages._learning_message_text (cognitive 17) libs/agno/agno/agent/_messages.py:889 — _messages._learning_message_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _media.prior_attachments (cognitive 17) · ×1
  • _media.prior_attachments (cognitive 17) libs/agno/agno/agents/_media.py:323 — _media.prior_attachments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeAgent._record_message_ref (cognitive 17) · ×1
  • ClaudeAgent._record_message_ref (cognitive 17) libs/agno/agno/agents/claude/agent.py:564 — ClaudeAgent._record_message_ref has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOSClient.upload_knowledge_content (cognitive 17) · ×1
  • AgentOSClient.upload_knowledge_content (cognitive 17) libs/agno/agno/client/os.py:2444 — AgentOSClient.upload_knowledge_content has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · compaction._grep (cognitive 17) · ×1
  • compaction._grep (cognitive 17) libs/agno/agno/compaction/compaction.py:1105 — compaction._grep has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routines._ensure_automation_schedule (cognitive 17) · ×1
  • routines._ensure_automation_schedule (cognitive 17) libs/agno/agno/company/routines.py:445 — routines._ensure_automation_schedule has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.__init__ (cognitive 17) · ×1
  • DynamoDb.__init__ (cognitive 17) libs/agno/agno/db/dynamo/dynamo.py:65 — DynamoDb.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb.get_knowledge_contents (cognitive 17) · ×1
  • DynamoDb.get_knowledge_contents (cognitive 17) libs/agno/agno/db/dynamo/dynamo.py:2117 — DynamoDb.get_knowledge_contents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcsJsonDb.upsert_session (cognitive 17) · ×1
  • GcsJsonDb.upsert_session (cognitive 17) libs/agno/agno/db/gcs_json/gcs_json_db.py:688 — GcsJsonDb.upsert_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, error handling 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.upsert_run (cognitive 17) · ×1
  • InMemoryDb.upsert_run (cognitive 17) libs/agno/agno/db/in_memory/in_memory_db.py:551 — InMemoryDb.upsert_run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.upsert_session (cognitive 17) · ×1
  • JsonDb.upsert_session (cognitive 17) libs/agno/agno/db/json/json_db.py:740 — JsonDb.upsert_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, error handling 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncMongoDb.get_runs (cognitive 17) · ×1
  • AsyncMongoDb.get_runs (cognitive 17) libs/agno/agno/db/mongo/async_mongo.py:733 — AsyncMongoDb.get_runs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, ternaries 2 (4 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AsyncMongoDb.upsert_session (cognitive 17) · ×1
  • AsyncMongoDb.upsert_session (cognitive 17) libs/agno/agno/db/mongo/async_mongo.py:1151 — AsyncMongoDb.upsert_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 2, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncMongoDb.get_trace_stats (cognitive 17) · ×1
  • AsyncMongoDb.get_trace_stats (cognitive 17) libs/agno/agno/db/mongo/async_mongo.py:2862 — AsyncMongoDb.get_trace_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 1, loops 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MongoDb.get_runs (cognitive 17) · ×1
  • MongoDb.get_runs (cognitive 17) libs/agno/agno/db/mongo/mongo.py:536 — MongoDb.get_runs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, ternaries 2 (4 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MongoDb.upsert_session (cognitive 17) · ×1
  • MongoDb.upsert_session (cognitive 17) libs/agno/agno/db/mongo/mongo.py:962 — MongoDb.upsert_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 2, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MongoDb.get_trace_stats (cognitive 17) · ×1
  • MongoDb.get_trace_stats (cognitive 17) libs/agno/agno/db/mongo/mongo.py:2726 — MongoDb.get_trace_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 1, loops 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncPostgresDb.transition_project (cognitive 17) · ×1
  • AsyncPostgresDb.transition_project (cognitive 17) libs/agno/agno/db/postgres/async_postgres.py:6779 — AsyncPostgresDb.transition_project has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PostgresDb.transition_project (cognitive 17) · ×1
  • PostgresDb.transition_project (cognitive 17) libs/agno/agno/db/postgres/postgres.py:9522 — PostgresDb.transition_project has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SingleStoreDb.upsert_memories (cognitive 17) · ×1
  • SingleStoreDb.upsert_memories (cognitive 17) libs/agno/agno/db/singlestore/singlestore.py:1935 — SingleStoreDb.upsert_memories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStoreDb.get_trace_stats (cognitive 17) · ×1
  • SingleStoreDb.get_trace_stats (cognitive 17) libs/agno/agno/db/singlestore/singlestore.py:3016 — SingleStoreDb.get_trace_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, error handling 1, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · company.create_company_source (cognitive 17) · ×1
  • company.create_company_source (cognitive 17) libs/agno/agno/db/sql/company.py:304 — company.create_company_source has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb.transition_project (cognitive 17) · ×1
  • AsyncSqliteDb.transition_project (cognitive 17) REDACTED:5948 — AsyncSqliteDb.transition_project has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SqliteDb.transition_project (cognitive 17) · ×1
  • SqliteDb.transition_project (cognitive 17) REDACTED:8451 — SqliteDb.transition_project has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · utils.aggregate_metrics_by_date (cognitive 17) · ×1
  • utils.aggregate_metrics_by_date (cognitive 17) REDACTED:789 — utils.aggregate_metrics_by_date has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, loops 3 (5 pts), if/else 2 (4 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · EnvironmentRunResult.diff (cognitive 17) · ×1
  • EnvironmentRunResult.diff (cognitive 17) libs/agno/agno/environments/runner.py:170 — EnvironmentRunResult.diff has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 4 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session.session_blocker (cognitive 17) · ×1
  • session.session_blocker (cognitive 17) libs/agno/agno/job_queue/session.py:43 — session.session_blocker has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgenticChunking.chunk (cognitive 17) · ×1
  • AgenticChunking.chunk (cognitive 17) libs/agno/agno/knowledge/chunking/agentic.py:57 — AgenticChunking.chunk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · page._split_long (cognitive 17) · ×1
  • page._split_long (cognitive 17) libs/agno/agno/knowledge/chunking/page.py:121 — page._split_long has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge._prepare_page_child (cognitive 17) · ×1
  • Knowledge._prepare_page_child (cognitive 17) libs/agno/agno/knowledge/knowledge.py:3281 — Knowledge._prepare_page_child has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Reader.get_missing_read_time_packages (cognitive 17) · ×1
  • Reader.get_missing_read_time_packages (cognitive 17) libs/agno/agno/knowledge/reader/base.py:107 — Reader.get_missing_read_time_packages has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirecrawlReader.crawl (cognitive 17) · ×1
  • FirecrawlReader.crawl (cognitive 17) libs/agno/agno/knowledge/reader/firecrawl_reader.py:126 — FirecrawlReader.crawl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownReader.async_read (cognitive 17) · ×1
  • MarkdownReader.async_read (cognitive 17) libs/agno/agno/knowledge/reader/markdown_reader.py:96 — MarkdownReader.async_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TavilyReader._extract (cognitive 17) · ×1
  • TavilyReader._extract (cognitive 17) libs/agno/agno/knowledge/reader/tavily_reader.py:83 — TavilyReader._extract has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 7, error handling 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TextReader.async_read (cognitive 17) · ×1
  • TextReader.async_read (cognitive 17) libs/agno/agno/knowledge/reader/text_reader.py:74 — TextReader.async_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MMRReranker._select (cognitive 17) · ×1
  • MMRReranker._select (cognitive 17) libs/agno/agno/knowledge/reranker/mmr.py:66 — MMRReranker._select has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityMemoryStore.aremember_about (cognitive 17) · ×1
  • EntityMemoryStore.aremember_about (cognitive 17) libs/agno/agno/learn/stores/entity_memory.py:1171 — EntityMemoryStore.aremember_about has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EntityMemoryStore._apply_supersessions (cognitive 17) · ×1
  • EntityMemoryStore._apply_supersessions (cognitive 17) libs/agno/agno/learn/stores/entity_memory.py:1454 — EntityMemoryStore._apply_supersessions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryManager.aoptimize_memories (cognitive 17) · ×1
  • MemoryManager.aoptimize_memories (cognitive 17) libs/agno/agno/memory/manager.py:868 — MemoryManager.aoptimize_memories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Claude._get_client_params (cognitive 17) · ×1
  • Claude._get_client_params (cognitive 17) libs/agno/agno/models/aws/claude.py:56 — Claude._get_client_params has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cerebras.parse_tool_calls (cognitive 17) · ×1
  • Cerebras.parse_tool_calls (cognitive 17) libs/agno/agno/models/cerebras/cerebras.py:537 — Cerebras.parse_tool_calls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiInteractions.invoke_stream (cognitive 17) · ×1
  • GeminiInteractions.invoke_stream (cognitive 17) libs/agno/agno/models/google/gemini_interactions.py:1296 — GeminiInteractions.invoke_stream has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (GeminiInteractions.ainvoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · GeminiInteractions.ainvoke_stream (cognitive 17) · ×1
  • GeminiInteractions.ainvoke_stream (cognitive 17) libs/agno/agno/models/google/gemini_interactions.py:1398 — GeminiInteractions.ainvoke_stream has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (GeminiInteractions.invoke_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · HuggingFace.get_request_params (cognitive 17) · ×1
  • HuggingFace.get_request_params (cognitive 17) libs/agno/agno/models/huggingface/huggingface.py:123 — HuggingFace.get_request_params has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16 (17 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OpenAIChat.invoke (cognitive 17) · ×1
  • OpenAIChat.invoke (cognitive 17) libs/agno/agno/models/openai/chat.py:392 — OpenAIChat.invoke has cognitive complexity 17 (threshold 15). Drivers by points: error handling 7 (9 pts), ternaries 3 (6 pts), if/else 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIChat.ainvoke) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · OpenAIChat.ainvoke (cognitive 17) · ×1
  • OpenAIChat.ainvoke (cognitive 17) libs/agno/agno/models/openai/chat.py:483 — OpenAIChat.ainvoke has cognitive complexity 17 (threshold 15). Drivers by points: error handling 7 (9 pts), ternaries 3 (6 pts), if/else 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIChat.invoke) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · store._render_matches (cognitive 17) · ×1
  • store._render_matches (cognitive 17) libs/agno/agno/offload/store.py:107 — store._render_matches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentOS._reprovision_routers (cognitive 17) · ×1
  • AgentOS._reprovision_routers (cognitive 17) libs/agno/agno/os/app.py:985 — AgentOS._reprovision_routers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RedisEventStream.reopen_run (cognitive 17) · ×1
  • RedisEventStream.reopen_run (cognitive 17) libs/agno/agno/os/event_streams/redis.py:352 — RedisEventStream.reopen_run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (4 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handlers._extract_team_response_chunk_content (cognitive 17) · ×1
  • handlers._extract_team_response_chunk_content (cognitive 17) libs/agno/agno/os/interfaces/agui/handlers.py:56 — handlers._extract_team_response_chunk_content has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 1 (2 pts), ternaries 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueWorker._sweep_job (cognitive 17) · ×1
  • QueueWorker._sweep_job (cognitive 17) libs/agno/agno/os/job_queue.py:1062 — QueueWorker._sweep_job has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp._server_card (cognitive 17) · ×1
  • mcp._server_card (cognitive 17) libs/agno/agno/os/mcp.py:2159 — mcp._server_card has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sandbox.enqueue_sandbox_run (cognitive 17) · ×1
  • sandbox.enqueue_sandbox_run (cognitive 17) libs/agno/agno/os/routers/agents/sandbox.py:16 — sandbox.enqueue_sandbox_run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · utils.run_agent_as_judge_eval (cognitive 17) · ×1
  • utils.run_agent_as_judge_eval (cognitive 17) libs/agno/agno/os/routers/evals/utils.py:56 — utils.run_agent_as_judge_eval has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 4 (6 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · router._get_agent_filesystems (cognitive 17) · ×1
  • router._get_agent_filesystems (cognitive 17) libs/agno/agno/os/routers/filesystem/router.py:82 — router._get_agent_filesystems has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), error handling 4 (5 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · groq.get_groq_reasoning_stream (cognitive 17) · ×1
  • groq.get_groq_reasoning_stream (cognitive 17) libs/agno/agno/reasoning/groq.py:97 — groq.get_groq_reasoning_stream has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (groq.aget_groq_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · groq.aget_groq_reasoning_stream (cognitive 17) · ×1
  • groq.aget_groq_reasoning_stream (cognitive 17) libs/agno/agno/reasoning/groq.py:148 — groq.aget_groq_reasoning_stream has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (groq.get_groq_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Registry._is_duplicate_tool (cognitive 17) · ×1
  • Registry._is_duplicate_tool (cognitive 17) libs/agno/agno/registry/registry.py:577 — Registry._is_duplicate_tool has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _session.aget_session (cognitive 17) · ×1
  • _session.aget_session (cognitive 17) libs/agno/agno/team/_session.py:106 — _session.aget_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityTools._extract_final_text (cognitive 17) · ×1
  • AntigravityTools._extract_final_text (cognitive 17) libs/agno/agno/tools/antigravity.py:276 — AntigravityTools._extract_final_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KernelSession.ensure_started (cognitive 17) · ×1
  • KernelSession.ensure_started (cognitive 17) libs/agno/agno/tools/code/kernel.py:384 — KernelSession.ensure_started has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, error handling 3 (4 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CsvTools.__init__ (cognitive 17) · ×1
  • CsvTools.__init__ (cognitive 17) libs/agno/agno/tools/csv_toolkit.py:11 — CsvTools.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · decorator._is_async_function (cognitive 17) · ×1
  • decorator._is_async_function (cognitive 17) libs/agno/agno/tools/decorator.py:13 — decorator._is_async_function has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DoclingTools._resolve_allowed_input_formats (cognitive 17) · ×1
  • DoclingTools._resolve_allowed_input_formats (cognitive 17) libs/agno/agno/tools/docling.py:506 — DoclingTools._resolve_allowed_input_formats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleCalendarTools.list_events (cognitive 17) · ×1
  • GoogleCalendarTools.list_events (cognitive 17) libs/agno/agno/tools/google/calendar.py:194 — GoogleCalendarTools.list_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 3 (5 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GoogleDriveTools.read_file (cognitive 17) · ×1
  • GoogleDriveTools.read_file (cognitive 17) libs/agno/agno/tools/google/drive.py:541 — GoogleDriveTools.read_file has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleSlidesTools.get_presentation_metadata (cognitive 17) · ×1
  • GoogleSlidesTools.get_presentation_metadata (cognitive 17) libs/agno/agno/tools/google/slides.py:843 — GoogleSlidesTools.get_presentation_metadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PlivoTools.__init__ (cognitive 17) · ×1
  • PlivoTools.__init__ (cognitive 17) libs/agno/agno/tools/plivo.py:16 — PlivoTools.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · StudioTools._component_row (cognitive 17) · ×1
  • StudioTools._component_row (cognitive 17) libs/agno/agno/tools/studio.py:1563 — StudioTools._component_row has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemini.has_additional_properties (cognitive 17) · ×1
  • gemini.has_additional_properties (cognitive 17) libs/agno/agno/utils/gemini.py:107 — gemini.has_additional_properties has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp.prepare_command (cognitive 17) · ×1
  • mcp.prepare_command (cognitive 17) libs/agno/agno/utils/mcp.py:377 — mcp.prepare_command has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · message.get_conversation_text (cognitive 17) · ×1
  • message.get_conversation_text (cognitive 17) libs/agno/agno/utils/message.py:356 — message.get_conversation_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.async_search (cognitive 17) · ×1
  • MongoDb.async_search (cognitive 17) REDACTED:1287 — MongoDb.async_search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qdrant._format_filters (cognitive 17) · ×1
  • Qdrant._format_filters (cognitive 17) REDACTED:872 — Qdrant._format_filters has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleStore.search (cognitive 17) · ×1
  • SingleStore.search (cognitive 17) REDACTED:394 — SingleStore.search has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (4 pts), error handling 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parallel.aexecute (cognitive 17) · ×1
  • Parallel.aexecute (cognitive 17) libs/agno/agno/workflow/parallel.py:678 — Parallel.aexecute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StepRequirement.to_dict (cognitive 17) · ×1
  • StepRequirement.to_dict (cognitive 17) libs/agno/agno/workflow/types.py:1107 — StepRequirement.to_dict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 6 (8 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Workflow.delete_session (cognitive 17) · ×1
  • Workflow.delete_session (cognitive 17) libs/agno/agno/workflow/workflow.py:1167 — Workflow.delete_session has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EbsVolume._create (cognitive 17) · ×1
  • EbsVolume._create (cognitive 17) libs/agno_infra/agno/aws/resource/ec2/volume.py:95 — EbsVolume._create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 1, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EbsVolume._read (cognitive 17) · ×1
  • EbsVolume._read (cognitive 17) libs/agno_infra/agno/aws/resource/ec2/volume.py:184 — EbsVolume._read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), boolean chains 2, error handling 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GlueCrawler._create (cognitive 17) · ×1
  • GlueCrawler._create (cognitive 17) libs/agno_infra/agno/aws/resource/glue/crawler.py:122 — GlueCrawler._create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, error handling 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SecretsManager.read_secrets_from_files (cognitive 17) · ×1
  • SecretsManager.read_secrets_from_files (cognitive 17) libs/agno_infra/agno/aws/resource/secret/manager.py:54 — SecretsManager.read_secrets_from_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · status.status (cognitive 17) · ×1
  • status.status (cognitive 17) libs/agnoctl/agnoctl/commands/status.py:14 — status.status has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 5 (6 pts), loops 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · team_events.run_team_with_events (cognitive 17) · ×1
  • team_events.run_team_with_events (cognitive 17) cookbook/03_teams/08_streaming/team_events.py:67 — team_events.run_team_with_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · post_hook_output.add_collaboration_summary (cognitive 17) · ×1
  • post_hook_output.add_collaboration_summary (cognitive 17) cookbook/03_teams/13_hooks/post_hook_output.py:182 — post_hook_output.add_collaboration_summary has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · background_execution_metrics.main (cognitive 17) · ×1
  • background_execution_metrics.main (cognitive 17) cookbook/03_teams/14_run_control/background_execution_metrics.py:54 — background_execution_metrics.main has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 5 (6 pts), boolean chains 3 (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · history_in_function.analyze_content_strategy (cognitive 17) · ×1
  • history_in_function.analyze_content_strategy (cognitive 17) cookbook/04_workflows/06_advanced_concepts/history/history_in_function.py:21 — history_in_function.analyze_content_strategy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 5, boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · 02_condition_on_error.run_pause_example (cognitive 17) · ×1
  • 02_condition_on_error.run_pause_example (cognitive 17) cookbook/04_workflows/08_human_in_the_loop/condition/02_condition_on_error.py:115 — 02_condition_on_error.run_pause_example has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 05_output_review_and_tool_confirmation.resolve_output_review (cognitive 17) · ×1
  • 05_output_review_and_tool_confirmation.resolve_output_review (cognitive 17) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:128 — 05_output_review_and_tool_confirmation.resolve_output_review has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unpack_archives.unpack_archives (cognitive 17) · ×1
  • unpack_archives.unpack_archives (cognitive 17) cookbook/05_agent_os/04_run_lifecycle/unpack_archives.py:35 — unpack_archives.unpack_archives has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jury_hardened.main (cognitive 17) · ×1
  • jury_hardened.main (cognitive 17) cookbook/data_labeling/_05_text_pairwise_preference/jury_hardened.py:135 — jury_hardened.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _bench.print_summary_table (cognitive 17) · ×1
  • _bench.print_summary_table (cognitive 17) cookbook/performance/_bench.py:270 — _bench.print_summary_table has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, ternaries 2 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · report.render_group (cognitive 17) · ×1
  • report.render_group (cognitive 17) cookbook/performance/report.py:304 — report.render_group has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, ternaries 3 (4 pts), loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _run.aresolve_run_dependencies (cognitive 16) · ×1
  • _run.aresolve_run_dependencies (cognitive 16) libs/agno/agno/agent/_run.py:189 — _run.aresolve_run_dependencies has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _tools._raise_if_async_tools_in_list (cognitive 16) · ×1
  • _tools._raise_if_async_tools_in_list (cognitive 16) libs/agno/agno/agent/_tools.py:106 — _tools._raise_if_async_tools_in_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Agent.__init__ (cognitive 16) · ×1
  • Agent.__init__ (cognitive 16) libs/agno/agno/agent/agent.py:412 — Agent.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · A2AClient.stream_message (cognitive 16) · ×1
  • A2AClient.stream_message (cognitive 16) libs/agno/agno/client/a2a/client.py:393 — A2AClient.stream_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _cut.choose_boundary (cognitive 16) · ×1
  • _cut.choose_boundary (cognitive 16) libs/agno/agno/compaction/_cut.py:89 — _cut.choose_boundary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _view.build_view (cognitive 16) · ×1
  • _view.build_view (cognitive 16) libs/agno/agno/compaction/_view.py:67 — _view.build_view has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routines._recovered_status_conflict (cognitive 16) · ×1
  • routines._recovered_status_conflict (cognitive 16) libs/agno/agno/company/routines.py:33 — routines._recovered_status_conflict has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · notion_ops._rich_text_to_md (cognitive 16) · ×1
  • notion_ops._rich_text_to_md (cognitive 16) libs/agno/agno/context/wiki/notion_ops.py:238 — notion_ops._rich_text_to_md has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClickhouseDb.get_trace_stats (cognitive 16) · ×1
  • ClickhouseDb.get_trace_stats (cognitive 16) libs/agno/agno/db/clickhouse/clickhouse.py:430 — ClickhouseDb.get_trace_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), error handling 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DynamoDb._get_metrics_calculation_starting_date (cognitive 16) · ×1
  • DynamoDb._get_metrics_calculation_starting_date (cognitive 16) libs/agno/agno/db/dynamo/dynamo.py:1708 — DynamoDb._get_metrics_calculation_starting_date has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FirestoreDb.rename_session (cognitive 16) · ×1
  • FirestoreDb.rename_session (cognitive 16) libs/agno/agno/db/firestore/firestore.py:864 — FirestoreDb.rename_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FirestoreDb.create_spans (cognitive 16) · ×1
  • FirestoreDb.create_spans (cognitive 16) libs/agno/agno/db/firestore/firestore.py:2620 — FirestoreDb.create_spans has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GcsJsonDb.get_user_memory_stats (cognitive 16) · ×1
  • GcsJsonDb.get_user_memory_stats (cognitive 16) libs/agno/agno/db/gcs_json/gcs_json_db.py:959 — GcsJsonDb.get_user_memory_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryDb.get_user_memory_stats (cognitive 16) · ×1
  • InMemoryDb.get_user_memory_stats (cognitive 16) libs/agno/agno/db/in_memory/in_memory_db.py:798 — InMemoryDb.get_user_memory_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JsonDb.get_user_memory_stats (cognitive 16) · ×1
  • JsonDb.get_user_memory_stats (cognitive 16) libs/agno/agno/db/json/json_db.py:1026 — JsonDb.get_user_memory_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3_0_0._swap_mysql_like_metrics_unique (cognitive 16) · ×1
  • v3_0_0._swap_mysql_like_metrics_unique (cognitive 16) REDACTED:2859 — v3_0_0._swap_mysql_like_metrics_unique has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._swap_async_mysql_metrics_unique) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · v3_0_0._swap_async_mysql_metrics_unique (cognitive 16) · ×1
  • v3_0_0._swap_async_mysql_metrics_unique (cognitive 16) REDACTED:2905 — v3_0_0._swap_async_mysql_metrics_unique has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (v3_0_0._swap_mysql_like_metrics_unique) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AsyncMongoDb.list_learnings (cognitive 16) · ×1
  • AsyncMongoDb.list_learnings (cognitive 16) libs/agno/agno/db/mongo/async_mongo.py:3723 — AsyncMongoDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 1, error handling 1, loops 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · async_mongo._detect_client_type (cognitive 16) · ×1
  • async_mongo._detect_client_type (cognitive 16) libs/agno/agno/db/mongo/async_mongo.py:113 — async_mongo._detect_client_type has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MongoDb.list_learnings (cognitive 16) · ×1
  • MongoDb.list_learnings (cognitive 16) libs/agno/agno/db/mongo/mongo.py:3523 — MongoDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 1, error handling 1, loops 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncPostgresDb.upsert_session (cognitive 16) · ×1
  • AsyncPostgresDb.upsert_session (cognitive 16) libs/agno/agno/db/postgres/async_postgres.py:1816 — AsyncPostgresDb.upsert_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncPostgresDb.list_learnings (cognitive 16) · ×1
  • AsyncPostgresDb.list_learnings (cognitive 16) libs/agno/agno/db/postgres/async_postgres.py:4308 — AsyncPostgresDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncPostgresDb.get_tasks (cognitive 16) · ×1
  • AsyncPostgresDb.get_tasks (cognitive 16) libs/agno/agno/db/postgres/async_postgres.py:6925 — AsyncPostgresDb.get_tasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 4 (5 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncPostgresDb.transition_task (cognitive 16) · ×1
  • AsyncPostgresDb.transition_task (cognitive 16) libs/agno/agno/db/postgres/async_postgres.py:7168 — AsyncPostgresDb.transition_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PostgresDb.upsert_session (cognitive 16) · ×1
  • PostgresDb.upsert_session (cognitive 16) libs/agno/agno/db/postgres/postgres.py:2045 — PostgresDb.upsert_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PostgresDb.upsert_memories (cognitive 16) · ×1
  • PostgresDb.upsert_memories (cognitive 16) libs/agno/agno/db/postgres/postgres.py:2792 — PostgresDb.upsert_memories has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresDb.list_learnings (cognitive 16) · ×1
  • PostgresDb.list_learnings (cognitive 16) libs/agno/agno/db/postgres/postgres.py:7039 — PostgresDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PostgresDb.get_tasks (cognitive 16) · ×1
  • PostgresDb.get_tasks (cognitive 16) libs/agno/agno/db/postgres/postgres.py:9660 — PostgresDb.get_tasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 4 (5 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PostgresDb.transition_task (cognitive 16) · ×1
  • PostgresDb.transition_task (cognitive 16) libs/agno/agno/db/postgres/postgres.py:9895 — PostgresDb.transition_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RedisDb._q_fenced_update (cognitive 16) · ×1
  • RedisDb._q_fenced_update (cognitive 16) libs/agno/agno/db/redis/redis.py:2802 — RedisDb._q_fenced_update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tasks.validate_task_fields (cognitive 16) · ×1
  • tasks.validate_task_fields (cognitive 16) libs/agno/agno/db/schemas/tasks.py:16 — tasks.validate_task_fields has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AsyncSqliteDb.get_session (cognitive 16) · ×1
  • AsyncSqliteDb.get_session (cognitive 16) REDACTED:1438 — AsyncSqliteDb.get_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsyncSqliteDb.list_learnings (cognitive 16) · ×1
  • AsyncSqliteDb.list_learnings (cognitive 16) REDACTED:4380 — AsyncSqliteDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncSqliteDb.get_tasks (cognitive 16) · ×1
  • AsyncSqliteDb.get_tasks (cognitive 16) REDACTED:6094 — AsyncSqliteDb.get_tasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 4 (5 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AsyncSqliteDb.transition_task (cognitive 16) · ×1
  • AsyncSqliteDb.transition_task (cognitive 16) REDACTED:6337 — AsyncSqliteDb.transition_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SqliteDb.get_session (cognitive 16) · ×1
  • SqliteDb.get_session (cognitive 16) REDACTED:1700 — SqliteDb.get_session has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqliteDb.list_learnings (cognitive 16) · ×1
  • SqliteDb.list_learnings (cognitive 16) REDACTED:6807 — SqliteDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SqliteDb.get_tasks (cognitive 16) · ×1
  • SqliteDb.get_tasks (cognitive 16) REDACTED:8589 — SqliteDb.get_tasks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 4 (5 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SqliteDb.transition_task (cognitive 16) · ×1
  • SqliteDb.transition_task (cognitive 16) REDACTED:8824 — SqliteDb.transition_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ValkeyDb.list_learnings (cognitive 16) · ×1
  • ValkeyDb.list_learnings (cognitive 16) libs/agno/agno/db/valkey/valkey.py:3243 — ValkeyDb.list_learnings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _render._attempt_lines (cognitive 16) · ×1
  • _render._attempt_lines (cognitive 16) libs/agno/agno/environments/_render.py:70 — _render._attempt_lines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · sft.to_sft_jsonl (cognitive 16) · ×1
  • sft.to_sft_jsonl (cognitive 16) libs/agno/agno/environments/exporters/sft.py:69 — sft.to_sft_jsonl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner._read_only_learning_machine (cognitive 16) · ×1
  • runner._read_only_learning_machine (cognitive 16) libs/agno/agno/environments/runner.py:557 — runner._read_only_learning_machine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _paths.normalize_path (cognitive 16) · ×1
  • _paths.normalize_path (cognitive 16) libs/agno/agno/fs/_paths.py:28 — _paths.normalize_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FileSystemTools.__init__ (cognitive 16) · ×1
  • FileSystemTools.__init__ (cognitive 16) libs/agno/agno/fs/toolkit.py:144 — FileSystemTools.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InMemoryQueueStore.enqueue_job (cognitive 16) · ×1
  • InMemoryQueueStore.enqueue_job (cognitive 16) libs/agno/agno/job_queue/store.py:34 — InMemoryQueueStore.enqueue_job has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownChunking._partition_markdown_content (cognitive 16) · ×1
  • MarkdownChunking._partition_markdown_content (cognitive 16) libs/agno/agno/knowledge/chunking/markdown.py:182 — MarkdownChunking._partition_markdown_content has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (3 pts), error handling 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Knowledge.get_readers (cognitive 16) · ×1
  • Knowledge.get_readers (cognitive 16) libs/agno/agno/knowledge/knowledge.py:1877 — Knowledge.get_readers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCoordinator.list (cognitive 16) · ×1
  • PageCoordinator.list (cognitive 16) REDACTED:1047 — PageCoordinator.list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCorpus._list (cognitive 16) · ×1
  • PageCorpus._list (cognitive 16) libs/agno/agno/knowledge/page/filesystem.py:253 — PageCorpus._list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownReader.read (cognitive 16) · ×1
  • MarkdownReader.read (cognitive 16) libs/agno/agno/knowledge/reader/markdown_reader.py:67 — MarkdownReader.read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SitemapReader._build_documents (cognitive 16) · ×1
  • SitemapReader._build_documents (cognitive 16) REDACTED:251 — SitemapReader._build_documents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextReader.read (cognitive 16) · ×1
  • TextReader.read (cognitive 16) libs/agno/agno/knowledge/reader/text_reader.py:39 — TextReader.read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecencyReranker.rerank (cognitive 16) · ×1
  • RecencyReranker.rerank (cognitive 16) libs/agno/agno/knowledge/reranker/recency.py:140 — RecencyReranker.rerank has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DecisionLogStore.asearch (cognitive 16) · ×1
  • DecisionLogStore.asearch (cognitive 16) libs/agno/agno/learn/stores/decision_log.py:723 — DecisionLogStore.asearch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HuggingFace._format_message (cognitive 16) · ×1
  • HuggingFace._format_message (cognitive 16) libs/agno/agno/models/huggingface/huggingface.py:194 — HuggingFace._format_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Llama._parse_provider_response (cognitive 16) · ×1
  • Llama._parse_provider_response (cognitive 16) libs/agno/agno/models/meta/llama.py:382 — Llama._parse_provider_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MoonShot._upload_media (cognitive 16) · ×1
  • MoonShot._upload_media (cognitive 16) libs/agno/agno/models/moonshot/moonshot.py:133 — MoonShot._upload_media has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, error handling 2, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MoonShot._extract_file_content (cognitive 16) · ×1
  • MoonShot._extract_file_content (cognitive 16) libs/agno/agno/models/moonshot/moonshot.py:188 — MoonShot._extract_file_content has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenRouter._parse_provider_response (cognitive 16) · ×1
  • OpenRouter._parse_provider_response (cognitive 16) libs/agno/agno/models/openrouter/openrouter.py:126 — OpenRouter._parse_provider_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 3 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SlackEventHandler.handle_non_streaming (cognitive 16) · ×1
  • SlackEventHandler.handle_non_streaming (cognitive 16) libs/agno/agno/os/interfaces/slack/event_handler.py:226 — SlackEventHandler.handle_non_streaming has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · helpers.send_response_media (cognitive 16) · ×1
  • helpers.send_response_media (cognitive 16) libs/agno/agno/os/interfaces/telegram/helpers.py:151 — helpers.send_response_media has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, loops 5, error handling 1 (2 pts), if/else 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · job_queue._apply_coordination (cognitive 16) · ×1
  • job_queue._apply_coordination (cognitive 16) libs/agno/agno/os/job_queue.py:81 — job_queue._apply_coordination has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (5 pts), boolean chains 1, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · mcp.build_mcp_server (cognitive 16) · ×1
  • mcp.build_mcp_server (cognitive 16) libs/agno/agno/os/mcp.py:2511 — mcp.build_mcp_server has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 3, if/else 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PublicLimiter._consume (cognitive 16) · ×1
  • PublicLimiter._consume (cognitive 16) libs/agno/agno/os/public/_limits.py:92 — PublicLimiter._consume has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PublicMiddleware._identity (cognitive 16) · ×1
  • PublicMiddleware._identity (cognitive 16) libs/agno/agno/os/public/_middleware.py:76 — PublicMiddleware._identity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, ternaries 2 (3 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · components._related_component_ids (cognitive 16) · ×1
  • components._related_component_ids (cognitive 16) libs/agno/agno/os/routers/components/components.py:52 — components._related_component_ids has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (4 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · components._resolve_db_in_config (cognitive 16) · ×1
  • components._resolve_db_in_config (cognitive 16) libs/agno/agno/os/routers/components/components.py:161 — components._resolve_db_in_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · utils.get_db (cognitive 16) · ×1
  • utils.get_db (cognitive 16) libs/agno/agno/os/utils.py:795 — utils.get_db has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · deepseek.get_deepseek_reasoning_stream (cognitive 16) · ×1
  • deepseek.get_deepseek_reasoning_stream (cognitive 16) libs/agno/agno/reasoning/deepseek.py:66 — deepseek.get_deepseek_reasoning_stream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (deepseek.aget_deepseek_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · deepseek.aget_deepseek_reasoning_stream (cognitive 16) · ×1
  • deepseek.aget_deepseek_reasoning_stream (cognitive 16) libs/agno/agno/reasoning/deepseek.py:145 — deepseek.aget_deepseek_reasoning_stream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (deepseek.get_deepseek_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · moonshot.get_moonshot_reasoning_stream (cognitive 16) · ×1
  • moonshot.get_moonshot_reasoning_stream (cognitive 16) libs/agno/agno/reasoning/moonshot.py:138 — moonshot.get_moonshot_reasoning_stream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (moonshot.aget_moonshot_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · moonshot.aget_moonshot_reasoning_stream (cognitive 16) · ×1
  • moonshot.aget_moonshot_reasoning_stream (cognitive 16) libs/agno/agno/reasoning/moonshot.py:183 — moonshot.aget_moonshot_reasoning_stream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (moonshot.get_moonshot_reasoning_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · background._execute_background (cognitive 16) · ×1
  • background._execute_background (cognitive 16) libs/agno/agno/run/background.py:36 — background._execute_background has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 5 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScheduleManager.create (cognitive 16) · ×1
  • ScheduleManager.create (cognitive 16) libs/agno/agno/scheduler/manager.py:158 — ScheduleManager.create has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (ScheduleManager.acreate) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ScheduleManager.acreate (cognitive 16) · ×1
  • ScheduleManager.acreate (cognitive 16) libs/agno/agno/scheduler/manager.py:408 — ScheduleManager.acreate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (ScheduleManager.create) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _cli._get_member_name (cognitive 16) · ×1
  • _cli._get_member_name (cognitive 16) libs/agno/agno/team/_cli.py:33 — _cli._get_member_name has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._sync_team_run_response_with_model_response (cognitive 16) · ×1
  • _run._sync_team_run_response_with_model_response (cognitive 16) libs/agno/agno/team/_run.py:4973 — _run._sync_team_run_response_with_model_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._aresolve_run_dependencies (cognitive 16) · ×1
  • _run._aresolve_run_dependencies (cognitive 16) libs/agno/agno/team/_run.py:5232 — _run._aresolve_run_dependencies has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _run._handle_team_tool_call_updates (cognitive 16) · ×1
  • _run._handle_team_tool_call_updates (cognitive 16) libs/agno/agno/team/_run.py:5383 — _run._handle_team_tool_call_updates has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (_run._handle_team_tool_call_updates_stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · _run._handle_team_tool_call_updates_stream (cognitive 16) · ×1
  • _run._handle_team_tool_call_updates_stream (cognitive 16) libs/agno/agno/team/_run.py:5444 — _run._handle_team_tool_call_updates_stream has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (_run._handle_team_tool_call_updates) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ToolBridge._call_tool (cognitive 16) · ×1
  • ToolBridge._call_tool (cognitive 16) libs/agno/agno/tools/code/bridge.py:974 — ToolBridge._call_tool has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodeMode._evict_past_the_cap (cognitive 16) · ×1
  • CodeMode._evict_past_the_cap (cognitive 16) libs/agno/agno/tools/code/code_mode.py:617 — CodeMode._evict_past_the_cap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FinanceTools.__init__ (cognitive 16) · ×1
  • FinanceTools.__init__ (cognitive 16) libs/agno/agno/tools/finance/toolkit.py:162 — FinanceTools.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleCalendarTools.search_events (cognitive 16) · ×1
  • GoogleCalendarTools.search_events (cognitive 16) libs/agno/agno/tools/google/calendar.py:842 — GoogleCalendarTools.search_events has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3 (5 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GmailTools._create_message (cognitive 16) · ×1
  • GmailTools._create_message (cognitive 16) libs/agno/agno/tools/google/gmail.py:1139 — GmailTools._create_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AIMLAPITools._transcript (cognitive 16) · ×1
  • AIMLAPITools._transcript (cognitive 16) libs/agno/agno/tools/models/aimlapi.py:380 — AIMLAPITools._transcript has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RedditTools.__init__ (cognitive 16) · ×1
  • RedditTools.__init__ (cognitive 16) libs/agno/agno/tools/reddit.py:15 — RedditTools.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScavioTools.__init__ (cognitive 16) · ×1
  • ScavioTools.__init__ (cognitive 16) libs/agno/agno/tools/scavio.py:15 — ScavioTools.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ShopifyTools.get_products_bought_together (cognitive 16) · ×1
  • ShopifyTools.get_products_bought_together (cognitive 16) libs/agno/agno/tools/shopify.py:456 — ShopifyTools.get_products_bought_together has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioTools._preserve_unresolved_keys (cognitive 16) · ×1
  • StudioTools._preserve_unresolved_keys (cognitive 16) libs/agno/agno/tools/studio.py:5239 — StudioTools._preserve_unresolved_keys has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioRunnerTools._copy_lost_identity (cognitive 16) · ×1
  • StudioRunnerTools._copy_lost_identity (cognitive 16) libs/agno/agno/tools/studio_runner.py:680 — StudioRunnerTools._copy_lost_identity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioRunnerTools._member_divergence (cognitive 16) · ×1
  • StudioRunnerTools._member_divergence (cognitive 16) libs/agno/agno/tools/studio_runner.py:812 — StudioRunnerTools._member_divergence has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StudioRunnerTools._unresolved_below (cognitive 16) · ×1
  • StudioRunnerTools._unresolved_below (cognitive 16) libs/agno/agno/tools/studio_runner.py:1625 — StudioRunnerTools._unresolved_below has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValyuTools._valyu_search (cognitive 16) · ×1
  • ValyuTools._valyu_search (cognitive 16) libs/agno/agno/tools/valyu.py:111 — ValyuTools._valyu_search has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 5, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · agent.collect_joint_images (cognitive 16) · ×1
  • agent.collect_joint_images (cognitive 16) libs/agno/agno/utils/agent.py:233 — agent.collect_joint_images has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (agent.collect_joint_videos, agent.collect_joint_audios) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · agent.collect_joint_videos (cognitive 16) · ×1
  • agent.collect_joint_videos (cognitive 16) libs/agno/agno/utils/agent.py:270 — agent.collect_joint_videos has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (agent.collect_joint_images, agent.collect_joint_audios) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · agent.collect_joint_audios (cognitive 16) · ×1
  • agent.collect_joint_audios (cognitive 16) libs/agno/agno/utils/agent.py:307 — agent.collect_joint_audios has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (agent.collect_joint_images, agent.collect_joint_videos) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · media_offload.offload_run_media (cognitive 16) · ×1
  • media_offload.offload_run_media (cognitive 16) libs/agno/agno/utils/media_offload.py:336 — media_offload.offload_run_media has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 6, error handling 1 (2 pts) (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (media_offload.aoffload_run_media) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · media_offload.aoffload_run_media (cognitive 16) · ×1
  • media_offload.aoffload_run_media (cognitive 16) libs/agno/agno/utils/media_offload.py:542 — media_offload.aoffload_run_media has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 6, error handling 1 (2 pts) (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: one other method here (media_offload.offload_run_media) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · media_offload.iter_step_outputs (cognitive 16) · ×1
  • media_offload.iter_step_outputs (cognitive 16) libs/agno/agno/utils/media_offload.py:595 — media_offload.iter_step_outputs has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CouchbaseSearch._create_collection_and_scope (cognitive 16) · ×1
  • CouchbaseSearch._create_collection_and_scope (cognitive 16) REDACTED:184 — CouchbaseSearch._create_collection_and_scope has cognitive complexity 16 (threshold 15). Drivers by points: error handling 8 (14 pts), if/else 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CouchbaseSearch._async_create_collection_and_scope) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CouchbaseSearch._async_create_collection_and_scope (cognitive 16) · ×1
  • CouchbaseSearch._async_create_collection_and_scope (cognitive 16) REDACTED:908 — CouchbaseSearch._async_create_collection_and_scope has cognitive complexity 16 (threshold 15). Drivers by points: error handling 8 (14 pts), if/else 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CouchbaseSearch._create_collection_and_scope) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CouchbaseSearch.__async_get_doc_from_kv (cognitive 16) · ×1
  • CouchbaseSearch.__async_get_doc_from_kv (cognitive 16) REDACTED:1363 — CouchbaseSearch.__async_get_doc_from_kv has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb._get_client (cognitive 16) · ×1
  • MongoDb._get_client (cognitive 16) REDACTED:148 — MongoDb._get_client has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (12 pts), if/else 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MongoDb.hybrid_search (cognitive 16) · ×1
  • MongoDb.hybrid_search (cognitive 16) REDACTED:826 — MongoDb.hybrid_search has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (3 pts), error handling 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ValkeyDb._filter_exprs_to_dict (cognitive 16) · ×1
  • ValkeyDb._filter_exprs_to_dict (cognitive 16) libs/agno/agno/vectordb/valkey/valkeydb.py:679 — ValkeyDb._filter_exprs_to_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Condition._aevaluate_condition (cognitive 16) · ×1
  • Condition._aevaluate_condition (cognitive 16) libs/agno/agno/workflow/condition.py:413 — Condition._aevaluate_condition has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Step._get_deepest_content_from_step_output (cognitive 16) · ×1
  • Step._get_deepest_content_from_step_output (cognitive 16) libs/agno/agno/workflow/step.py:2634 — Step._get_deepest_content_from_step_output has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 3, loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Workflow.aget_run (cognitive 16) · ×1
  • Workflow.aget_run (cognitive 16) libs/agno/agno/workflow/workflow.py:5642 — Workflow.aget_run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 1 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CursorAdapter.list_entries (cognitive 16) · ×1
  • CursorAdapter.list_entries (cognitive 16) libs/agnoctl/agnoctl/clients/cursor.py:44 — CursorAdapter.list_entries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 09_multi_step_mixed_hitl.resolve_output_review (cognitive 16) · ×1
  • 09_multi_step_mixed_hitl.resolve_output_review (cognitive 16) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:194 — 09_multi_step_mixed_hitl.resolve_output_review has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sse_reconnect.iter_sse (cognitive 16) · ×1
  • sse_reconnect.iter_sse (cognitive 16) cookbook/05_agent_os/04_run_lifecycle/sse_reconnect.py:69 — sse_reconnect.iter_sse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (14 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · capture_reasoning_content_knowledge_tools.run_example (cognitive 16) · ×1
  • capture_reasoning_content_knowledge_tools.run_example (cognitive 16) cookbook/10_reasoning/tools/capture_reasoning_content_knowledge_tools.py:22 — capture_reasoning_content_knowledge_tools.run_example has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · save_hitl_condition_loop_router.save_and_verify (cognitive 16) · ×1
  • save_hitl_condition_loop_router.save_and_verify (cognitive 16) cookbook/93_components/workflows/save_hitl_condition_loop_router.py:164 — save_hitl_condition_loop_router.save_and_verify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · FunctionTooLong · ×1
  • FunctionTooLong: index.html.imageSearch cookbook/data_labeling/image_search/public/index.html:273 — FunctionTooLong — imageSearch runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D35 · Change Coupling · Change coupling clique · ×1
  • Change coupling clique: router.py, router.py, router.py libs/agno/agno/os/routers/agents/router.py — 3 files — `libs/agno/agno/os/routers/agents/router.py`, `libs/agno/agno/os/routers/teams/router.py`, `libs/agno/agno/os/routers/workflows/router.py` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (15 members, 21 shared lines) · ×1
  • Near-duplicate member family (15 members, 21 shared lines) REDACTED:247 — REDACTED:247-310 | REDACTED:461-555 | REDACTED:662-761 | REDACTED:402-485 | REDACTED:1081-1170 | REDACTED:1197-1285 | REDACTED:605-694 | REDACTED:777-873 | REDACTED:1148-1213 | REDACTED:1222-1285 | REDACTED:719-769 | REDACTED:377-446 | REDACTED:671-744 | REDACTED:753-842 | REDACTED:371-469 — These 15 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 15 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 15 times.
D4 · Code Duplication · Near-duplicate member family (12 members, 57 shared lines) · ×1
  • Near-duplicate member family (12 members, 57 shared lines) libs/agno/agno/db/dynamo/utils.py:356 — libs/agno/agno/db/dynamo/utils.py:356-453 | libs/agno/agno/db/firestore/utils.py:194-297 | libs/agno/agno/db/gcs_json/utils.py:52-150 | libs/agno/agno/db/in_memory/utils.py:52-150 | libs/agno/agno/db/json/utils.py:52-150 | libs/agno/agno/db/mongo/utils.py:141-235 | libs/agno/agno/db/mysql/utils.py:234-330 | libs/agno/agno/db/postgres/utils.py:285-382 | libs/agno/agno/db/redis/utils.py:198-296 | libs/agno/agno/db/singlestore/utils.py:261-357 | libs/agno/agno/db/sqlite/utils.py:245-347 | libs/agno/agno/db/valkey/utils.py:393-491 — These 12 members are variants of one another: a block of 57 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 12 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 12 times.
D4 · Code Duplication · Near-duplicate member family (11 members, 37 shared lines) · ×1
  • Near-duplicate member family (11 members, 37 shared lines) libs/agno/agno/db/dynamo/dynamo.py:1629 — libs/agno/agno/db/dynamo/dynamo.py:1629-1706 | libs/agno/agno/db/firestore/firestore.py:1635-1691 | libs/agno/agno/db/mongo/async_mongo.py:1955-2011 | libs/agno/agno/db/mongo/mongo.py:1760-1816 | libs/agno/agno/db/mysql/async_mysql.py:2155-2223 | libs/agno/agno/db/mysql/mysql.py:2126-2190 | libs/agno/agno/db/postgres/async_postgres.py:2487-2558 | libs/agno/agno/db/postgres/postgres.py:3016-3087 | libs/agno/agno/db/singlestore/singlestore.py:2151-2217 | REDACTED:2681-2752 | REDACTED:2933-3004 — These 11 members are variants of one another: a block of 37 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication · Near-duplicate member family (9 members, 20 shared lines) · ×1
  • Near-duplicate member family (9 members, 20 shared lines) libs/agno/agno/db/dynamo/utils.py:356 — libs/agno/agno/db/dynamo/utils.py:356-453 | libs/agno/agno/db/gcs_json/utils.py:52-150 | libs/agno/agno/db/in_memory/utils.py:52-150 | libs/agno/agno/db/json/utils.py:52-150 | libs/agno/agno/db/mysql/utils.py:234-330 | libs/agno/agno/db/postgres/utils.py:285-382 | libs/agno/agno/db/redis/utils.py:198-296 | libs/agno/agno/db/singlestore/utils.py:261-357 | libs/agno/agno/db/surrealdb/metrics.py:275-373 — These 9 members are variants of one another: a block of 20 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication · Near-duplicate member family (8 members, 44 shared lines) · ×1
  • Near-duplicate member family (8 members, 44 shared lines) libs/agno/agno/db/mysql/mysql.py:1683 — libs/agno/agno/db/mysql/mysql.py:1683-1755 | libs/agno/agno/db/mysql/mysql.py:2589-2672 | libs/agno/agno/db/postgres/postgres.py:2558-2627 | libs/agno/agno/db/postgres/postgres.py:3536-3619 | libs/agno/agno/db/singlestore/singlestore.py:1722-1792 | libs/agno/agno/db/singlestore/singlestore.py:2585-2668 | REDACTED:2479-2549 | REDACTED:3396-3478 — These 8 members are variants of one another: a block of 44 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (8 members, 34 shared lines) · ×1
  • Near-duplicate member family (8 members, 34 shared lines) cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:93 — cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/01_step_confirmation_and_tool_confirmation.py:93-131 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/02_step_user_input_and_tool_confirmation.py:104-142 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/03_condition_and_tool_confirmation.py:122-161 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/04_router_selection_and_tool_confirmation.py:129-168 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/05_output_review_and_tool_confirmation.py:86-125 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/06_loop_confirmation_and_tool_confirmation.py:105-145 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/07_router_confirmation_and_tool_confirmation.py:123-160 | cookbook/04_workflows/08_human_in_the_loop/dual_level_hitl/09_multi_step_mixed_hitl.py:213-250 — These 8 members are variants of one another: a block of 34 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (7 members, 32 shared lines) · ×1
  • Near-duplicate member family (7 members, 32 shared lines) libs/agno/agno/db/mysql/async_mysql.py:564 — libs/agno/agno/db/mysql/async_mysql.py:564-600 | libs/agno/agno/db/mysql/mysql.py:560-594 | libs/agno/agno/db/postgres/async_postgres.py:861-897 | libs/agno/agno/db/postgres/postgres.py:1017-1051 | libs/agno/agno/db/singlestore/singlestore.py:639-673 | REDACTED:816-852 | REDACTED:981-1018 — These 7 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (7 members, 29 shared lines) · ×1
  • Near-duplicate member family (7 members, 29 shared lines) libs/agno/agno/db/mysql/async_mysql.py:1223 — libs/agno/agno/db/mysql/async_mysql.py:1223-1321 | libs/agno/agno/db/mysql/mysql.py:1212-1306 | libs/agno/agno/db/postgres/async_postgres.py:1819-1927 | libs/agno/agno/db/postgres/postgres.py:2048-2156 | libs/agno/agno/db/singlestore/singlestore.py:1270-1365 | REDACTED:1714-1804 | REDACTED:1971-2061 — These 7 members are variants of one another: a block of 29 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (7 members, 25 shared lines) · ×1
  • Near-duplicate member family (7 members, 25 shared lines) libs/agno/agno/db/mysql/async_mysql.py:749 — libs/agno/agno/db/mysql/async_mysql.py:749-792 | libs/agno/agno/db/mysql/mysql.py:738-783 | libs/agno/agno/db/postgres/async_postgres.py:1069-1133 | libs/agno/agno/db/postgres/postgres.py:1218-1282 | libs/agno/agno/db/singlestore/singlestore.py:797-839 | REDACTED:1020-1090 | REDACTED:1205-1274 — These 7 members are variants of one another: a block of 25 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (7 members, 13 shared lines) · ×1
  • Near-duplicate member family (7 members, 13 shared lines) libs/agno/agno/db/mysql/async_mysql.py:174 — libs/agno/agno/db/mysql/async_mysql.py:174-313 | libs/agno/agno/db/mysql/mysql.py:170-306 | libs/agno/agno/db/postgres/async_postgres.py:344-501 | libs/agno/agno/db/postgres/postgres.py:383-594 | libs/agno/agno/db/singlestore/singlestore.py:236-406 | REDACTED:329-479 | REDACTED:380-588 — These 7 members are variants of one another: a block of 13 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 24 shared lines) · ×1
  • Near-duplicate member family (6 members, 24 shared lines) libs/agno/agno/tools/studio_runner.py:2680 — libs/agno/agno/tools/studio_runner.py:2680-2735 | libs/agno/agno/tools/studio_runner.py:2746-2801 | libs/agno/agno/tools/studio_runner.py:2812-2867 | libs/agno/agno/tools/studio_runner.py:2878-2936 | libs/agno/agno/tools/studio_runner.py:2947-3002 | libs/agno/agno/tools/studio_runner.py:3013-3070 — These 6 members are variants of one another: a block of 24 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 91 shared lines) · ×1
  • Near-duplicate member family (5 members, 91 shared lines) libs/agno/agno/db/mysql/async_mysql.py:1326 — libs/agno/agno/db/mysql/async_mysql.py:1326-1546 | libs/agno/agno/db/mysql/mysql.py:1311-1527 | libs/agno/agno/db/singlestore/singlestore.py:1370-1571 | REDACTED:1812-2062 | REDACTED:2069-2319 — These 5 members are variants of one another: a block of 91 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 201 shared lines) · ×1
  • Near-duplicate member family (4 members, 201 shared lines) libs/agno/agno/workflow/workflow.py:6973 — libs/agno/agno/workflow/workflow.py:6973-7502 | libs/agno/agno/workflow/workflow.py:7817-8585 | libs/agno/agno/workflow/workflow.py:9035-9564 | libs/agno/agno/workflow/workflow.py:9577-10351 — These 4 members are variants of one another: a block of 201 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 198 shared lines) · ×1
  • Near-duplicate member family (4 members, 198 shared lines) libs/agno/agno/workflow/workflow.py:3287 — libs/agno/agno/workflow/workflow.py:3287-3850 | libs/agno/agno/workflow/workflow.py:4292-4908 | libs/agno/agno/workflow/workflow.py:7817-8585 | libs/agno/agno/workflow/workflow.py:9577-10351 — These 4 members are variants of one another: a block of 198 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 119 shared lines) · ×1
  • Near-duplicate member family (4 members, 119 shared lines) libs/agno/agno/agent/_messages.py:925 — libs/agno/agno/agent/_messages.py:925-1210 | libs/agno/agno/agent/_messages.py:1221-1513 | libs/agno/agno/team/_messages.py:438-681 | libs/agno/agno/team/_messages.py:696-937 — These 4 members are variants of one another: a block of 119 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 93 shared lines) · ×1
  • Near-duplicate member family (4 members, 93 shared lines) libs/agno/agno/utils/print_response/team.py:49 — libs/agno/agno/utils/print_response/team.py:49-356 | libs/agno/agno/utils/print_response/team.py:387-954 | libs/agno/agno/utils/print_response/team.py:984-1289 | libs/agno/agno/utils/print_response/team.py:1320-1903 — These 4 members are variants of one another: a block of 93 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 87 shared lines) · ×1
  • Near-duplicate member family (4 members, 87 shared lines) libs/agno/agno/workflow/step.py:1111 — libs/agno/agno/workflow/step.py:1111-1357 | libs/agno/agno/workflow/step.py:1439-1775 | libs/agno/agno/workflow/step.py:1794-2078 | libs/agno/agno/workflow/step.py:2101-2502 — These 4 members are variants of one another: a block of 87 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 83 shared lines) · ×1
  • Near-duplicate member family (4 members, 83 shared lines) libs/agno/agno/workflow/workflow.py:2938 — libs/agno/agno/workflow/workflow.py:2938-3273 | libs/agno/agno/workflow/workflow.py:3928-4277 | libs/agno/agno/workflow/workflow.py:6973-7502 | libs/agno/agno/workflow/workflow.py:9035-9564 — These 4 members are variants of one another: a block of 83 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 62 shared lines) · ×1
  • Near-duplicate member family (4 members, 62 shared lines) libs/agno/agno/session/agent.py:151 — libs/agno/agno/session/agent.py:151-262 | libs/agno/agno/session/team.py:141-273 | libs/agno/agno/session/workflow.py:239-333 | libs/agno/agno/session/workflow.py:346-445 — These 4 members are variants of one another: a block of 62 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 48 shared lines) · ×1
  • Near-duplicate member family (4 members, 48 shared lines) libs/agno/agno/db/mysql/async_mysql.py:1703 — libs/agno/agno/db/mysql/async_mysql.py:1703-1775 | libs/agno/agno/db/mysql/async_mysql.py:2621-2704 | libs/agno/agno/db/postgres/async_postgres.py:2102-2171 | libs/agno/agno/db/postgres/async_postgres.py:2993-3076 — These 4 members are variants of one another: a block of 48 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 47 shared lines) · ×1
  • Near-duplicate member family (4 members, 47 shared lines) libs/agno/agno/agent/_messages.py:1538 — libs/agno/agno/agent/_messages.py:1538-1692 | libs/agno/agno/agent/_messages.py:1708-1862 | libs/agno/agno/team/_messages.py:1227-1369 | libs/agno/agno/team/_messages.py:1386-1528 — These 4 members are variants of one another: a block of 47 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 42 shared lines) · ×1
  • Near-duplicate member family (4 members, 42 shared lines) libs/agno/agno/db/mysql/async_mysql.py:174 — libs/agno/agno/db/mysql/async_mysql.py:174-313 | libs/agno/agno/db/mysql/mysql.py:170-306 | libs/agno/agno/db/postgres/async_postgres.py:344-501 | libs/agno/agno/db/singlestore/singlestore.py:236-406 — These 4 members are variants of one another: a block of 42 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 36 shared lines) · ×1
  • Near-duplicate member family (4 members, 36 shared lines) REDACTED:664 — REDACTED:664-882 | REDACTED:897-1105 | REDACTED:1381-1611 | REDACTED:1662-1892 — These 4 members are variants of one another: a block of 36 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 35 shared lines) · ×1
  • Near-duplicate member family (4 members, 35 shared lines) libs/agno/agno/db/mysql/mysql.py:170 — libs/agno/agno/db/mysql/mysql.py:170-306 | libs/agno/agno/db/postgres/async_postgres.py:344-501 | libs/agno/agno/db/singlestore/singlestore.py:236-406 | REDACTED:329-479 — These 4 members are variants of one another: a block of 35 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 34 shared lines) · ×1
  • Near-duplicate member family (4 members, 34 shared lines) libs/agno/agno/workflow/condition.py:332 — libs/agno/agno/workflow/condition.py:332-368 | libs/agno/agno/workflow/loop.py:383-420 | libs/agno/agno/workflow/router.py:428-462 | libs/agno/agno/workflow/steps.py:206-242 — These 4 members are variants of one another: a block of 34 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 32 shared lines) · ×1
  • Near-duplicate member family (4 members, 32 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6789 — libs/agno/agno/db/postgres/async_postgres.py:6789-6855 | libs/agno/agno/db/postgres/postgres.py:9532-9594 | REDACTED:5958-6024 | REDACTED:8461-8523 — These 4 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 29 shared lines) · ×1
  • Near-duplicate member family (4 members, 29 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6939 — libs/agno/agno/db/postgres/async_postgres.py:6939-6983 | libs/agno/agno/db/postgres/postgres.py:9674-9718 | REDACTED:6108-6152 | REDACTED:8603-8647 — These 4 members are variants of one another: a block of 29 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 26 shared lines) · ×1
  • Near-duplicate member family (4 members, 26 shared lines) REDACTED:227 — REDACTED:227-272 | REDACTED:275-321 | REDACTED:324-373 | REDACTED:376-427 — These 4 members are variants of one another: a block of 26 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 25 shared lines) · ×1
  • Near-duplicate member family (4 members, 25 shared lines) libs/agno/agno/db/mysql/mysql.py:2084 — libs/agno/agno/db/mysql/mysql.py:2084-2123 | libs/agno/agno/db/postgres/postgres.py:2973-3013 | libs/agno/agno/db/singlestore/singlestore.py:2109-2148 | REDACTED:2894-2930 — These 4 members are variants of one another: a block of 25 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 22 shared lines) · ×1
  • Near-duplicate member family (4 members, 22 shared lines) libs/agno/agno/db/gcs_json/gcs_json_db.py:1495 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1495-1547 | libs/agno/agno/db/json/json_db.py:1595-1647 | libs/agno/agno/db/redis/redis.py:1839-1901 | libs/agno/agno/db/valkey/valkey.py:2269-2335 — These 4 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 19 shared lines) · ×1
  • Near-duplicate member family (4 members, 19 shared lines) libs/agno/agno/db/mysql/mysql.py:2313 — libs/agno/agno/db/mysql/mysql.py:2313-2368 | libs/agno/agno/db/postgres/postgres.py:3219-3271 | libs/agno/agno/db/singlestore/singlestore.py:2336-2392 | REDACTED:3143-3195 — These 4 members are variants of one another: a block of 19 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 11 shared lines) · ×1
  • Near-duplicate member family (4 members, 11 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6084 — libs/agno/agno/db/postgres/async_postgres.py:6084-6112 | libs/agno/agno/db/postgres/postgres.py:8844-8873 | REDACTED:5253-5283 | REDACTED:7775-7804 — These 4 members are variants of one another: a block of 11 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 10 shared lines) · ×1
  • Near-duplicate member family (4 members, 10 shared lines) libs/agno/agno/db/postgres/async_postgres.py:6480 — libs/agno/agno/db/postgres/async_postgres.py:6480-6504 | libs/agno/agno/db/postgres/postgres.py:9231-9253 | REDACTED:5649-5673 | REDACTED:8160-8182 — These 4 members are variants of one another: a block of 10 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 8 shared lines) · ×1
  • Near-duplicate member family (4 members, 8 shared lines) libs/agno/agno/workflow/condition.py:292 — libs/agno/agno/workflow/condition.py:292-324 | libs/agno/agno/workflow/loop.py:350-375 | libs/agno/agno/workflow/parallel.py:156-180 | libs/agno/agno/workflow/steps.py:173-198 — These 4 members are variants of one another: a block of 8 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 49 shared lines) · ×1
  • Near-duplicate member family (3 members, 49 shared lines) libs/agno/agno/os/utils.py:2969 — libs/agno/agno/os/utils.py:2969-3048 | libs/agno/agno/os/utils.py:3064-3129 | libs/agno/agno/os/utils.py:3145-3210 — These 3 members are variants of one another: a block of 49 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (684 shared lines) · ×1
  • Near-duplicate member pair (684 shared lines) libs/agno/agno/os/routers/agents/router.py:653 — libs/agno/agno/os/routers/agents/router.py:653-2651 | libs/agno/agno/os/routers/teams/router.py:574-2408 — These two members are variants of one another: 684 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (314 shared lines) · ×1
  • Near-duplicate member pair (314 shared lines) libs/agno/agno/team/_run.py:591 — libs/agno/agno/team/_run.py:591-1079 | libs/agno/agno/team/_run.py:1458-1898 — These two members are variants of one another: 314 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (293 shared lines) · ×1
  • Near-duplicate member pair (293 shared lines) libs/agno/agno/team/_run.py:2506 — libs/agno/agno/team/_run.py:2506-3041 | libs/agno/agno/team/_run.py:3632-4128 — These two members are variants of one another: 293 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (291 shared lines) · ×1
  • Near-duplicate member pair (291 shared lines) libs/agno/agno/agent/_run.py:2140 — libs/agno/agno/agent/_run.py:2140-2708 | libs/agno/agno/agent/_run.py:5211-5822 — These two members are variants of one another: 291 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (251 shared lines) · ×1
  • Near-duplicate member pair (251 shared lines) libs/agno/agno/agent/_run.py:4687 — libs/agno/agno/agent/_run.py:4687-5187 | libs/agno/agno/agent/_run.py:5211-5822 — These two members are variants of one another: 251 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (248 shared lines) · ×1
  • Near-duplicate member pair (248 shared lines) libs/agno/agno/workflow/workflow.py:6591 — libs/agno/agno/workflow/workflow.py:6591-6961 | libs/agno/agno/workflow/workflow.py:8631-9023 — These two members are variants of one another: 248 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (240 shared lines) · ×1
  • Near-duplicate member pair (240 shared lines) libs/agno/agno/team/_run.py:9343 — libs/agno/agno/team/_run.py:9343-9800 | libs/agno/agno/team/_run.py:9825-10517 — These two members are variants of one another: 240 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (188 shared lines) · ×1
  • Near-duplicate member pair (188 shared lines) libs/agno/agno/db/postgres/postgres.py:5885 — libs/agno/agno/db/postgres/postgres.py:5885-6092 | REDACTED:5674-5882 — These two members are variants of one another: 188 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (182 shared lines) · ×1
  • Near-duplicate member pair (182 shared lines) libs/agno/agno/agent/_run.py:1528 — libs/agno/agno/agent/_run.py:1528-1954 | libs/agno/agno/agent/_run.py:4687-5187 — These two members are variants of one another: 182 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (179 shared lines) · ×1
  • Near-duplicate member pair (179 shared lines) libs/agno/agno/team/_run.py:3632 — libs/agno/agno/team/_run.py:3632-4128 | libs/agno/agno/team/_run.py:9825-10517 — These two members are variants of one another: 179 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (173 shared lines) · ×1
  • Near-duplicate member pair (173 shared lines) libs/agno/agno/agent/_run.py:794 — libs/agno/agno/agent/_run.py:794-1318 | libs/agno/agno/agent/_run.py:2140-2708 — These two members are variants of one another: 173 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (158 shared lines) · ×1
  • Near-duplicate member pair (158 shared lines) libs/agno/agno/team/_run.py:1458 — libs/agno/agno/team/_run.py:1458-1898 | libs/agno/agno/team/_run.py:8380-8645 — These two members are variants of one another: 158 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (155 shared lines) · ×1
  • Near-duplicate member pair (155 shared lines) libs/agno/agno/agent/_run.py:1528 — libs/agno/agno/agent/_run.py:1528-1954 | libs/agno/agno/agent/_run.py:2140-2708 — These two members are variants of one another: 155 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (153 shared lines) · ×1
  • Near-duplicate member pair (153 shared lines) libs/agno/agno/reasoning/manager.py:382 — libs/agno/agno/reasoning/manager.py:382-617 | libs/agno/agno/reasoning/manager.py:622-857 — These two members are variants of one another: 153 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (149 shared lines) · ×1
  • Near-duplicate member pair (149 shared lines) libs/agno/agno/team/_run.py:2506 — libs/agno/agno/team/_run.py:2506-3041 | libs/agno/agno/team/_run.py:9825-10517 — These two members are variants of one another: 149 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (147 shared lines) · ×1
  • Near-duplicate member pair (147 shared lines) libs/agno/agno/agent/_default_tools.py:85 — libs/agno/agno/agent/_default_tools.py:85-260 | libs/agno/agno/team/_default_tools.py:1596-1760 — These two members are variants of one another: 147 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (140 shared lines) · ×1
  • Near-duplicate member pair (140 shared lines) libs/agno/agno/team/_run.py:2131 — libs/agno/agno/team/_run.py:2131-2487 | libs/agno/agno/team/_run.py:2506-3041 — These two members are variants of one another: 140 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (132 shared lines) · ×1
  • Near-duplicate member pair (132 shared lines) libs/agno/agno/agent/_messages.py:1897 — libs/agno/agno/agent/_messages.py:1897-2091 | libs/agno/agno/agent/_messages.py:2112-2306 — These two members are variants of one another: 132 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (128 shared lines) · ×1
  • Near-duplicate member pair (128 shared lines) libs/agno/agno/team/_run.py:250 — libs/agno/agno/team/_run.py:250-572 | libs/agno/agno/team/_run.py:591-1079 — These two members are variants of one another: 128 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (125 shared lines) · ×1
  • Near-duplicate member pair (125 shared lines) libs/agno/agno/knowledge/knowledge.py:3393 — libs/agno/agno/knowledge/knowledge.py:3393-3593 | libs/agno/agno/knowledge/knowledge.py:3606-3784 — These two members are variants of one another: 125 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (119 shared lines) · ×1
  • Near-duplicate member pair (119 shared lines) libs/agno/agno/db/mongo/async_mongo.py:1263 — libs/agno/agno/db/mongo/async_mongo.py:1263-1419 | libs/agno/agno/db/mongo/mongo.py:1072-1229 — These two members are variants of one another: 119 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (116 shared lines) · ×1
  • Near-duplicate member pair (116 shared lines) libs/agno/agno/agent/_response.py:1040 — libs/agno/agno/agent/_response.py:1040-1190 | libs/agno/agno/agent/_response.py:1204-1356 — These two members are variants of one another: 116 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (109 shared lines) · ×1
  • Near-duplicate member pair (109 shared lines) libs/agno/agno/eval/accuracy.py:365 — libs/agno/agno/eval/accuracy.py:365-502 | libs/agno/agno/eval/accuracy.py:510-646 — These two members are variants of one another: 109 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (107 shared lines) · ×1
  • Near-duplicate member pair (107 shared lines) libs/agno/agno/utils/print_response/agent.py:54 — libs/agno/agno/utils/print_response/agent.py:54-232 | libs/agno/agno/utils/print_response/agent.py:261-439 — These two members are variants of one another: 107 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (102 shared lines) · ×1
  • Near-duplicate member pair (102 shared lines) libs/agno/agno/eval/performance.py:500 — libs/agno/agno/eval/performance.py:500-632 | libs/agno/agno/eval/performance.py:637-774 — These two members are variants of one another: 102 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (95 shared lines) · ×1
  • Near-duplicate member pair (95 shared lines) libs/agno/agno/eval/accuracy.py:655 — libs/agno/agno/eval/accuracy.py:655-762 | libs/agno/agno/eval/accuracy.py:771-876 — These two members are variants of one another: 95 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (84 shared lines) · ×1
  • Near-duplicate member pair (84 shared lines) libs/agno/agno/agent/_tools.py:480 — libs/agno/agno/agent/_tools.py:480-649 | libs/agno/agno/team/_tools.py:137-510 — These two members are variants of one another: 84 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (82 shared lines) · ×1
  • Near-duplicate member pair (82 shared lines) libs/agno/agno/workflow/workflow.py:5784 — libs/agno/agno/workflow/workflow.py:5784-5947 | libs/agno/agno/workflow/workflow.py:6184-6366 — These two members are variants of one another: 82 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (78 shared lines) · ×1
  • Near-duplicate member pair (78 shared lines) libs/agno/agno/knowledge/reader/website_reader.py:156 — libs/agno/agno/knowledge/reader/website_reader.py:156-288 | libs/agno/agno/knowledge/reader/website_reader.py:291-401 — These two members are variants of one another: 78 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (69 shared lines) · ×1
  • Near-duplicate member pair (69 shared lines) libs/agno/agno/scheduler/manager.py:175 — libs/agno/agno/scheduler/manager.py:175-271 | libs/agno/agno/scheduler/manager.py:425-521 — These two members are variants of one another: 69 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (64 shared lines) · ×1
  • Near-duplicate member pair (64 shared lines) libs/agno/agno/learn/stores/user_memory.py:1173 — libs/agno/agno/learn/stores/user_memory.py:1173-1313 | libs/agno/agno/learn/stores/user_memory.py:1323-1467 — These two members are variants of one another: 64 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (60 shared lines) · ×1
  • Near-duplicate member pair (60 shared lines) libs/agno/agno/team/_messages.py:1657 — libs/agno/agno/team/_messages.py:1657-1722 | libs/agno/agno/utils/prompts.py:10-95 — These two members are variants of one another: 60 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (59 shared lines) · ×1
  • Near-duplicate member pair (59 shared lines) libs/agno/agno/utils/print_response/agent.py:580 — libs/agno/agno/utils/print_response/agent.py:580-671 | libs/agno/agno/utils/print_response/agent.py:700-791 — These two members are variants of one another: 59 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (55 shared lines) · ×1
  • Near-duplicate member pair (55 shared lines) libs/agno/agno/knowledge/loaders/sharepoint.py:217 — libs/agno/agno/knowledge/loaders/sharepoint.py:217-327 | libs/agno/agno/knowledge/loaders/sharepoint.py:336-446 — These two members are variants of one another: 55 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) libs/agno/agno/knowledge/knowledge.py:876 — libs/agno/agno/knowledge/knowledge.py:876-992 | libs/agno/agno/knowledge/knowledge.py:1023-1161 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (51 shared lines) · ×1
  • Near-duplicate member pair (51 shared lines) libs/agno/agno/db/mongo/async_mongo.py:983 — libs/agno/agno/db/mongo/async_mongo.py:983-1078 | libs/agno/agno/db/mongo/mongo.py:793-889 — These two members are variants of one another: 51 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (50 shared lines) · ×1
  • Near-duplicate member pair (50 shared lines) libs/agno/agno/agent/_messages.py:2533 — libs/agno/agno/agent/_messages.py:2533-2643 | libs/agno/agno/agent/_messages.py:2656-2768 — These two members are variants of one another: 50 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (49 shared lines) · ×1
  • Near-duplicate member pair (49 shared lines) libs/agno/agno/team/_default_tools.py:1773 — libs/agno/agno/team/_default_tools.py:1773-1863 | libs/agno/agno/team/_default_tools.py:1876-1985 — These two members are variants of one another: 49 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (48 shared lines) · ×1
  • Near-duplicate member pair (48 shared lines) libs/agno/agno/knowledge/knowledge.py:4932 — libs/agno/agno/knowledge/knowledge.py:4932-5101 | libs/agno/agno/knowledge/knowledge.py:5104-5285 — These two members are variants of one another: 48 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (47 shared lines) · ×1
  • Near-duplicate member pair (47 shared lines) libs/agno/agno/agent/_response.py:174 — libs/agno/agno/agent/_response.py:174-249 | libs/agno/agno/team/_response.py:588-662 — These two members are variants of one another: 47 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (46 shared lines) · ×1
  • Near-duplicate member pair (46 shared lines) libs/agno/agno/tools/minimax.py:79 — libs/agno/agno/tools/minimax.py:79-156 | libs/agno/agno/tools/minimax.py:165-238 — These two members are variants of one another: 46 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (42 shared lines) · ×1
  • Near-duplicate member pair (42 shared lines) libs/agno/agno/knowledge/knowledge.py:2402 — libs/agno/agno/knowledge/knowledge.py:2402-2467 | libs/agno/agno/knowledge/knowledge.py:2477-2542 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (41 shared lines) · ×1
  • Near-duplicate member pair (41 shared lines) libs/agno/agno/agent/_response.py:755 — libs/agno/agno/agent/_response.py:755-837 | libs/agno/agno/team/_response.py:805-895 — These two members are variants of one another: 41 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (38 shared lines) · ×1
  • Near-duplicate member pair (38 shared lines) REDACTED:1214 — REDACTED:1214-1309 | REDACTED:1312-1397 — These two members are variants of one another: 38 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (34 shared lines) · ×1
  • Near-duplicate member pair (34 shared lines) libs/agno/agno/tools/studio.py:3789 — libs/agno/agno/tools/studio.py:3789-3853 | libs/agno/agno/tools/studio.py:3865-3934 — These two members are variants of one another: 34 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (30 shared lines) · ×1
  • Near-duplicate member pair (30 shared lines) libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:96 — libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:96-169 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:179-297 — These two members are variants of one another: 30 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (23 shared lines) · ×1
  • Near-duplicate member pair (23 shared lines) libs/agno/agno/db/mongo/async_mongo.py:1917 — libs/agno/agno/db/mongo/async_mongo.py:1917-1952 | libs/agno/agno/db/mongo/mongo.py:1724-1757 — These two members are variants of one another: 23 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×1
  • Edited copy of a member (35 corresponding lines) libs/agno/agno/db/gcs_json/gcs_json_db.py:338 — libs/agno/agno/db/gcs_json/gcs_json_db.py:338-372 | libs/agno/agno/db/json/json_db.py:374-411 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) REDACTED:1118 — REDACTED:1118-1175 | REDACTED:1188-1245 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) libs/agno/agno/db/redis/redis.py:498 — libs/agno/agno/db/redis/redis.py:498-547 | libs/agno/agno/db/valkey/valkey.py:594-633 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×1
  • Edited copy of a member (42 corresponding lines) libs/agno/agno/db/gcs_json/gcs_json_db.py:914 — libs/agno/agno/db/gcs_json/gcs_json_db.py:914-957 | libs/agno/agno/db/json/json_db.py:981-1024 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×1
  • Edited copy of a member (28 corresponding lines) libs/agno/agno/db/postgres/async_postgres.py:7062 — libs/agno/agno/db/postgres/async_postgres.py:7062-7089 | REDACTED:6231-6258 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×1
  • Edited copy of a member (26 corresponding lines) libs/agno/agno/db/postgres/postgres.py:9791 — libs/agno/agno/db/postgres/postgres.py:9791-9816 | REDACTED:8720-8745 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×1
  • Edited copy of a member (21 corresponding lines) libs/agno/agno/tracing/schemas.py:47 — libs/agno/agno/tracing/schemas.py:47-83 | libs/agno/agno/tracing/schemas.py:114-147 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×1
  • Edited copy of a member (19 corresponding lines) libs/agno/agno/db/surrealdb/surrealdb.py:2150 — libs/agno/agno/db/surrealdb/surrealdb.py:2150-2176 | libs/agno/agno/db/surrealdb/surrealdb.py:2179-2209 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×1
  • Edited copy of a member (34 corresponding lines) libs/agno/agno/db/postgres/postgres.py:175 — libs/agno/agno/db/postgres/postgres.py:175-286 | REDACTED:136-285 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (21 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (21 members, 50+ identical tokens) libs/agno/agno/agent/_cli.py:60 — libs/agno/agno/agent/_cli.py:60-136 | libs/agno/agno/agent/_cli.py:167-236 | libs/agno/agno/agent/_run.py:4213-4396 | libs/agno/agno/agent/agent.py:1314-1342 | libs/agno/agno/agent/agent.py:1372-1400 | libs/agno/agno/agent/agent.py:1548-1572 | libs/agno/agno/agent/agent.py:1656-1681 | libs/agno/agno/agent/agent.py:1743-1765 | libs/agno/agno/agent/agent.py:1828-1851 | libs/agno/agno/agent/remote.py:286-353 | libs/agno/agno/team/_cli.py:76-155 | libs/agno/agno/team/_cli.py:187-261 | libs/agno/agno/team/_run.py:9154-9320 | libs/agno/agno/team/remote.py:279-346 | libs/agno/agno/team/team.py:943-967 | libs/agno/agno/team/team.py:1052-1077 | libs/agno/agno/team/team.py:1144-1166 | libs/agno/agno/team/team.py:1230-1253 | libs/agno/agno/team/team.py:1313-1342 | libs/agno/agno/team/team.py:1373-1402 | libs/agno/agno/workflow/workflow.py:10825-11038 — These 21 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 21 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 21 times.
D4 · Code Duplication · Members sharing a duplicated core (20 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (20 members, 50+ identical tokens) libs/agno/agno/workflow/condition.py:492 — libs/agno/agno/workflow/condition.py:492-657 | libs/agno/agno/workflow/condition.py:681-927 | libs/agno/agno/workflow/condition.py:947-1110 | libs/agno/agno/workflow/condition.py:1134-1382 | libs/agno/agno/workflow/loop.py:441-581 | libs/agno/agno/workflow/loop.py:604-825 | libs/agno/agno/workflow/loop.py:846-978 | libs/agno/agno/workflow/loop.py:1001-1222 | libs/agno/agno/workflow/parallel.py:326-455 | libs/agno/agno/workflow/parallel.py:478-676 | libs/agno/agno/workflow/parallel.py:695-821 | libs/agno/agno/workflow/parallel.py:844-1029 | libs/agno/agno/workflow/router.py:638-760 | libs/agno/agno/workflow/router.py:783-950 | libs/agno/agno/workflow/router.py:969-1097 | libs/agno/agno/workflow/router.py:1120-1292 | libs/agno/agno/workflow/steps.py:261-373 | libs/agno/agno/workflow/steps.py:396-548 | libs/agno/agno/workflow/steps.py:567-678 | libs/agno/agno/workflow/steps.py:701-852 — These 20 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 20 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 20 times.
D4 · Code Duplication · Duplicated block (390 lines × 2) · ×1
  • Duplicated block (390 lines × 2) libs/agno/agno/utils/print_response/workflow.py:365 — libs/agno/agno/utils/print_response/workflow.py:365-754 | libs/agno/agno/utils/print_response/workflow.py:1230-1619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (185–186 lines × 2) · ×1
  • Duplicated block (185–186 lines × 2) libs/agno/agno/db/postgres/postgres.py:5140 — libs/agno/agno/db/postgres/postgres.py:5140-5325 | REDACTED:4980-5164 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (124 lines × 2) · ×1
  • Duplicated block (124 lines × 2) libs/agno/agno/db/postgres/postgres.py:5553 — libs/agno/agno/db/postgres/postgres.py:5553-5676 | REDACTED:5347-5470 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5553` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (120–121 lines × 2) · ×1
  • Duplicated block (120–121 lines × 2) libs/agno/agno/db/postgres/postgres.py:4743 — libs/agno/agno/db/postgres/postgres.py:4743-4863 | REDACTED:4585-4704 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (105–109 lines × 2) · ×1
  • Duplicated block (105–109 lines × 2) libs/agno/agno/db/redis/redis.py:860 — libs/agno/agno/db/redis/redis.py:860-964 | libs/agno/agno/db/valkey/valkey.py:990-1098 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (105 lines × 2) · ×1
  • Duplicated block (105 lines × 2) libs/agno/agno/agent/_run.py:4835 — libs/agno/agno/agent/_run.py:4835-4939 | libs/agno/agno/agent/_run.py:5354-5458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:4835` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (98 lines × 3) · ×1
  • Duplicated block (98 lines × 3) libs/agno/agno/os/routers/agents/router.py:523 — libs/agno/agno/os/routers/agents/router.py:523-620 | libs/agno/agno/os/routers/teams/router.py:287-384 | libs/agno/agno/os/routers/workflows/router.py:1466-1563 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (93 lines × 2) · ×1
  • Duplicated block (93 lines × 2) libs/agno/agno/db/postgres/postgres.py:5754 — libs/agno/agno/db/postgres/postgres.py:5754-5846 | REDACTED:5545-5637 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5754` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (92–93 lines × 2) · ×1
  • Duplicated block (92–93 lines × 2) libs/agno/agno/utils/print_response/team.py:707 — libs/agno/agno/utils/print_response/team.py:707-798 | libs/agno/agno/utils/print_response/team.py:1639-1731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/team.py:707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (92 lines × 2) · ×1
  • Duplicated block (92 lines × 2) libs/agno/agno/agent/_messages.py:1538 — libs/agno/agno/agent/_messages.py:1538-1629 | libs/agno/agno/agent/_messages.py:1708-1799 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (91 lines × 2) · ×1
  • Duplicated block (91 lines × 2) libs/agno/agno/db/postgres/postgres.py:4864 — libs/agno/agno/db/postgres/postgres.py:4864-4954 | REDACTED:4705-4795 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (86 lines × 2) · ×1
  • Duplicated block (86 lines × 2) libs/agno/agno/agent/_messages.py:1016 — libs/agno/agno/agent/_messages.py:1016-1101 | libs/agno/agno/agent/_messages.py:1313-1398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:1016` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_messages.py:1400` calls `has_async_db`, `aget_user_memories` and `libs/agno/agno/agent/_messages.py:1103` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (84–85 lines × 2) · ×1
  • Duplicated block (84–85 lines × 2) libs/agno/agno/utils/print_response/team.py:110 — libs/agno/agno/utils/print_response/team.py:110-193 | libs/agno/agno/utils/print_response/team.py:1045-1129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (81–82 lines × 2) · ×1
  • Duplicated block (81–82 lines × 2) REDACTED:754 — REDACTED:754-835 | REDACTED:978-1058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:754` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (78–79 lines × 2) · ×1
  • Duplicated block (78–79 lines × 2) libs/agno/agno/workflow/workflow.py:6647 — libs/agno/agno/workflow/workflow.py:6647-6725 | libs/agno/agno/workflow/workflow.py:8680-8757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (74–75 lines × 3) · ×1
  • Duplicated block (74–75 lines × 3) libs/agno/agno/db/mysql/mysql.py:331 — libs/agno/agno/db/mysql/mysql.py:331-405 | libs/agno/agno/db/postgres/postgres.py:639-713 | libs/agno/agno/db/singlestore/singlestore.py:409-482 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (70–75 lines × 2) · ×1
  • Duplicated block (70–75 lines × 2) libs/agno/agno/agent/_storage.py:1365 — libs/agno/agno/agent/_storage.py:1365-1439 | libs/agno/agno/team/_storage.py:1243-1312 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (75 lines × 2) · ×1
  • Duplicated block (75 lines × 2) libs/agno/agno/team/_run.py:9426 — libs/agno/agno/team/_run.py:9426-9500 | libs/agno/agno/team/_run.py:9909-9983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (69–73 lines × 2) · ×1
  • Duplicated block (69–73 lines × 2) libs/agno/agno/os/routers/agents/schema.py:168 — libs/agno/agno/os/routers/agents/schema.py:168-240 | libs/agno/agno/os/routers/teams/schema.py:155-223 — `libs/agno/agno/os/routers/agents/schema.py` and `libs/agno/agno/os/routers/teams/schema.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 157 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (71–72 lines × 2) · ×1
  • Duplicated block (71–72 lines × 2) libs/agno/agno/agent/_tools.py:887 — libs/agno/agno/agent/_tools.py:887-958 | libs/agno/agno/agent/_tools.py:1003-1073 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:887` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `agent` to `"Agent"` in one and `Agent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (68–71 lines × 2) · ×1
  • Duplicated block (68–71 lines × 2) libs/agno/agno/agent/_run.py:4325 — libs/agno/agno/agent/_run.py:4325-4392 | libs/agno/agno/team/_run.py:9246-9316 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:4325` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (68–69 lines × 2) · ×1
  • Duplicated block (68–69 lines × 2) libs/agno/agno/db/postgres/postgres.py:4664 — libs/agno/agno/db/postgres/postgres.py:4664-4732 | REDACTED:4507-4574 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (64–68 lines × 2) · ×1
  • Duplicated block (64–68 lines × 2) cookbook/02_agents/18_checkpointing/03_checkpoint_endpoints.py:55 — cookbook/02_agents/18_checkpointing/03_checkpoint_endpoints.py:55-122 | cookbook/03_teams/23_checkpointing/03_checkpoint_endpoints.py:62-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/18_checkpointing/03_checkpoint_endpoints.py:55` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (68 lines × 2) · ×1
  • Duplicated block (68 lines × 2) libs/agno/agno/agent/_messages.py:2016 — libs/agno/agno/agent/_messages.py:2016-2083 | libs/agno/agno/agent/_messages.py:2231-2298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:2016` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (67–68 lines × 2) · ×1
  • Duplicated block (67–68 lines × 2) libs/agno/agno/agent/_messages.py:2702 — libs/agno/agno/agent/_messages.py:2702-2768 | libs/agno/agno/team/_default_tools.py:1918-1985 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (64–66 lines × 2) · ×1
  • Duplicated block (64–66 lines × 2) libs/agno/agno/team/_run.py:825 — libs/agno/agno/team/_run.py:825-890 | libs/agno/agno/team/_run.py:2758-2821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (65 lines × 2) · ×1
  • Duplicated block (65 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1305 — libs/agno/agno/db/mongo/async_mongo.py:1305-1369 | libs/agno/agno/db/mongo/mongo.py:1114-1178 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1305` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (64 lines × 2) · ×1
  • Duplicated block (64 lines × 2) libs/agno/agno/db/postgres/postgres.py:5054 — libs/agno/agno/db/postgres/postgres.py:5054-5117 | REDACTED:4894-4957 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (63–64 lines × 2) · ×1
  • Duplicated block (63–64 lines × 2) libs/agno/agno/learn/stores/session_context.py:904 — libs/agno/agno/learn/stores/session_context.py:904-967 | libs/agno/agno/learn/stores/session_context.py:1046-1108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/session_context.py:1046` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (57–63 lines × 2) · ×1
  • Duplicated block (57–63 lines × 2) libs/agno/agno/workflow/workflow.py:6867 — libs/agno/agno/workflow/workflow.py:6867-6929 | libs/agno/agno/workflow/workflow.py:8902-8958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (60–61 lines × 2) · ×1
  • Duplicated block (60–61 lines × 2) libs/agno/agno/agent/_run.py:2367 — libs/agno/agno/agent/_run.py:2367-2426 | libs/agno/agno/agent/_run.py:5510-5570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2367` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (52–61 lines × 2) · ×1
  • Duplicated block (52–61 lines × 2) REDACTED:103 — REDACTED:103-154 | REDACTED:136-196 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (61 lines × 2) · ×1
  • Duplicated block (61 lines × 2) libs/agno/agno/team/_messages.py:1309 — libs/agno/agno/team/_messages.py:1309-1369 | libs/agno/agno/team/_messages.py:1468-1528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_messages.py:1309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (48–60 lines × 2) · ×1
  • Duplicated block (48–60 lines × 2) libs/agno/agno/agent/_run.py:2944 — libs/agno/agno/agent/_run.py:2944-3003 | libs/agno/agno/team/_run.py:6911-6958 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `"TeamRunOutput"` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (49–59 lines × 4) · ×1
  • Duplicated block (49–59 lines × 4) libs/agno/agno/workflow/workflow.py:3491 — libs/agno/agno/workflow/workflow.py:3491-3549 | libs/agno/agno/workflow/workflow.py:4532-4589 | libs/agno/agno/workflow/workflow.py:8336-8384 | libs/agno/agno/workflow/workflow.py:10096-10144 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (58–59 lines × 2) · ×1
  • Duplicated block (58–59 lines × 2) libs/agno/agno/models/google/gemini.py:1279 — libs/agno/agno/models/google/gemini.py:1279-1336 | libs/agno/agno/models/google/gemini.py:1429-1487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (57–58 lines × 2) · ×1
  • Duplicated block (57–58 lines × 2) libs/agno/agno/db/postgres/postgres.py:5693 — libs/agno/agno/db/postgres/postgres.py:5693-5749 | REDACTED:5483-5540 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (58 lines × 2) · ×1
  • Duplicated block (58 lines × 2) libs/agno/agno/os/interfaces/a2a/router.py:292 — libs/agno/agno/os/interfaces/a2a/router.py:292-349 | libs/agno/agno/os/interfaces/a2a/router.py:619-676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/interfaces/a2a/router.py:290` calls `HTTPException`, `isinstance` and `libs/agno/agno/os/interfaces/a2a/router.py:618` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (52–58 lines × 2) · ×1
  • Duplicated block (52–58 lines × 2) libs/agno/agno/team/_run.py:281 — libs/agno/agno/team/_run.py:281-332 | libs/agno/agno/team/_run.py:1164-1221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:281` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:278` calls `raise_if_cancelled` and `libs/agno/agno/team/_run.py:1163` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (54–57 lines × 2) · ×1
  • Duplicated block (54–57 lines × 2) libs/agno/agno/knowledge/loaders/gcs.py:91 — libs/agno/agno/knowledge/loaders/gcs.py:91-147 | libs/agno/agno/knowledge/loaders/gcs.py:181-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/loaders/gcs.py:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (43–57 lines × 2) · ×1
  • Duplicated block (43–57 lines × 2) libs/agno/agno/learn/stores/learned_knowledge.py:892 — libs/agno/agno/learn/stores/learned_knowledge.py:892-948 | libs/agno/agno/learn/stores/learned_knowledge.py:976-1018 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (49–56 lines × 3) · ×1
  • Duplicated block (49–56 lines × 3) libs/agno/agno/agent/_run.py:3466 — libs/agno/agno/agent/_run.py:3466-3521 | libs/agno/agno/agent/_run.py:4807-4855 | libs/agno/agno/agent/_run.py:5325-5374 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (55 lines × 2) · ×1
  • Duplicated block (55 lines × 2) libs/agno/agno/db/postgres/postgres.py:1554 — libs/agno/agno/db/postgres/postgres.py:1554-1608 | REDACTED:1505-1559 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:1554` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (52–53 lines × 2) · ×1
  • Duplicated block (52–53 lines × 2) libs/agno/agno/db/postgres/postgres.py:6224 — libs/agno/agno/db/postgres/postgres.py:6224-6276 | REDACTED:6010-6061 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (33–53 lines × 2) · ×1
  • Duplicated block (33–53 lines × 2) libs/agno/agno/knowledge/knowledge.py:716 — libs/agno/agno/knowledge/knowledge.py:716-768 | libs/agno/agno/knowledge/knowledge.py:810-842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (51–52 lines × 2) · ×1
  • Duplicated block (51–52 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:691 — libs/agno/agno/db/gcs_json/gcs_json_db.py:691-741 | libs/agno/agno/db/json/json_db.py:743-794 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (47–52 lines × 2) · ×1
  • Duplicated block (47–52 lines × 2) libs/agno/agno/team/_run.py:9349 — libs/agno/agno/team/_run.py:9349-9400 | libs/agno/agno/team/_run.py:9837-9883 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (44–51 lines × 2) · ×1
  • Duplicated block (44–51 lines × 2) libs/agno/agno/os/routers/agents/router.py:653 — libs/agno/agno/os/routers/agents/router.py:653-703 | libs/agno/agno/os/routers/teams/router.py:574-617 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:653` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (48–51 lines × 2) · ×1
  • Duplicated block (48–51 lines × 2) libs/agno/agno/tools/searchapi.py:99 — libs/agno/agno/tools/searchapi.py:99-149 | libs/agno/agno/tools/searchapi.py:158-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (43–50 lines × 12) · ×1
  • Duplicated block (43–50 lines × 12) libs/agno/agno/db/dynamo/utils.py:356 — libs/agno/agno/db/dynamo/utils.py:356-405 | libs/agno/agno/db/firestore/utils.py:194-241 | libs/agno/agno/db/gcs_json/utils.py:52-101 | libs/agno/agno/db/in_memory/utils.py:52-101 | libs/agno/agno/db/json/utils.py:52-101 | libs/agno/agno/db/mongo/utils.py:141-183 | libs/agno/agno/db/mysql/utils.py:234-283 | libs/agno/agno/db/postgres/utils.py:285-333 | libs/agno/agno/db/redis/utils.py:198-247 | libs/agno/agno/db/singlestore/utils.py:261-310 | libs/agno/agno/db/sqlite/utils.py:245-293 | libs/agno/agno/db/valkey/utils.py:393-442 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/firestore/utils.py:244` calls `isinstance`, `loads` and `libs/agno/agno/db/dynamo/utils.py:408` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (44–50 lines × 6) · ×1
  • Duplicated block (44–50 lines × 6) libs/agno/agno/client/os.py:537 — libs/agno/agno/client/os.py:537-586 | libs/agno/agno/client/os.py:604-647 | libs/agno/agno/client/os.py:818-862 | libs/agno/agno/client/os.py:880-924 | libs/agno/agno/client/os.py:1127-1170 | libs/agno/agno/client/os.py:1188-1232 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (47–50 lines × 4) · ×1
  • Duplicated block (47–50 lines × 4) libs/agno/agno/agent/_messages.py:981 — libs/agno/agno/agent/_messages.py:981-1030 | libs/agno/agno/agent/_messages.py:1278-1327 | libs/agno/agno/team/_messages.py:496-542 | libs/agno/agno/team/_messages.py:750-796 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:981` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (49–50 lines × 2) · ×1
  • Duplicated block (49–50 lines × 2) libs/agno/agno/agent/_messages.py:2594 — libs/agno/agno/agent/_messages.py:2594-2643 | libs/agno/agno/team/_default_tools.py:1815-1863 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (45–49 lines × 2) · ×1
  • Duplicated block (45–49 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1688 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1688-1736 | libs/agno/agno/db/json/json_db.py:1792-1836 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (46–48 lines × 4) · ×1
  • Duplicated block (46–48 lines × 4) libs/agno/agno/session/agent.py:198 — libs/agno/agno/session/agent.py:198-245 | libs/agno/agno/session/team.py:211-256 | libs/agno/agno/session/workflow.py:269-316 | libs/agno/agno/session/workflow.py:383-428 — before extracting anything, compare `libs/agno/agno/session/agent.py` and `libs/agno/agno/session/team.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (47–48 lines × 2) · ×1
  • Duplicated block (47–48 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:2416 — libs/agno/agno/db/mysql/async_mysql.py:2416-2463 | libs/agno/agno/db/mysql/mysql.py:2391-2437 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (48 lines × 2) · ×1
  • Duplicated block (48 lines × 2) libs/agno/agno/utils/print_response/team.py:605 — libs/agno/agno/utils/print_response/team.py:605-652 | libs/agno/agno/utils/print_response/team.py:1536-1583 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (47 lines × 3) · ×1
  • Duplicated block (47 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2972 — libs/agno/agno/db/mysql/async_mysql.py:2972-3018 | libs/agno/agno/db/postgres/async_postgres.py:3355-3401 | REDACTED:3501-3547 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (42–47 lines × 2) · ×1
  • Duplicated block (42–47 lines × 2) libs/agno/agno/agent/_init.py:123 — libs/agno/agno/agent/_init.py:123-169 | libs/agno/agno/team/_init.py:721-762 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (37–47 lines × 2) · ×1
  • Duplicated block (37–47 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:499 — libs/agno/agno/db/mysql/async_mysql.py:499-535 | libs/agno/agno/db/postgres/async_postgres.py:784-830 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (46–47 lines × 2) · ×1
  • Duplicated block (46–47 lines × 2) libs/agno/agno/db/postgres/postgres.py:4581 — libs/agno/agno/db/postgres/postgres.py:4581-4626 | REDACTED:4422-4468 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:4581` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (45–46 lines × 4) · ×1
  • Duplicated block (45–46 lines × 4) libs/agno/agno/db/mysql/mysql.py:2939 — libs/agno/agno/db/mysql/mysql.py:2939-2984 | libs/agno/agno/db/postgres/postgres.py:3899-3944 | libs/agno/agno/db/singlestore/singlestore.py:2879-2924 | REDACTED:3697-3741 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (45–46 lines × 3) · ×1
  • Duplicated block (45–46 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2911 — libs/agno/agno/db/mysql/async_mysql.py:2911-2956 | libs/agno/agno/db/mysql/mysql.py:2878-2923 | libs/agno/agno/db/singlestore/singlestore.py:2819-2863 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2911` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (44–46 lines × 3) · ×1
  • Duplicated block (44–46 lines × 3) libs/agno/agno/db/mysql/mysql.py:2014 — libs/agno/agno/db/mysql/mysql.py:2014-2059 | libs/agno/agno/db/singlestore/singlestore.py:2043-2086 | REDACTED:2826-2871 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:2014` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (41–45 lines × 3) · ×1
  • Duplicated block (41–45 lines × 3) libs/agno/agno/team/_run.py:7517 — libs/agno/agno/team/_run.py:7517-7561 | libs/agno/agno/team/_run.py:9393-9433 | libs/agno/agno/team/_run.py:9876-9916 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:9393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (39–45 lines × 2) · ×1
  • Duplicated block (39–45 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:175 — libs/agno/agno/db/mongo/async_mongo.py:175-219 | libs/agno/agno/db/mongo/mongo.py:80-118 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:175` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (40–45 lines × 2) · ×1
  • Duplicated block (40–45 lines × 2) libs/agno/agno/db/postgres/postgres.py:4518 — libs/agno/agno/db/postgres/postgres.py:4518-4562 | REDACTED:4364-4403 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–45 lines × 2) · ×1
  • Duplicated block (26–45 lines × 2) libs/agno/agno/learn/stores/decision_log.py:378 — libs/agno/agno/learn/stores/decision_log.py:378-422 | libs/agno/agno/learn/stores/decision_log.py:445-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/decision_log.py:445` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (35–45 lines × 2) · ×1
  • Duplicated block (35–45 lines × 2) libs/agno/agno/models/google/gemini.py:1838 — libs/agno/agno/models/google/gemini.py:1838-1882 | libs/agno/agno/models/google/gemini.py:1903-1937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (42–45 lines × 2) · ×1
  • Duplicated block (42–45 lines × 2) libs/agno/agno/os/routers/agents/schema.py:263 — libs/agno/agno/os/routers/agents/schema.py:263-304 | libs/agno/agno/os/routers/teams/schema.py:232-276 — `libs/agno/agno/os/routers/agents/schema.py` and `libs/agno/agno/os/routers/teams/schema.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 157 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (39–44 lines × 4) · ×1
  • Duplicated block (39–44 lines × 4) libs/agno/agno/db/mysql/mysql.py:1039 — libs/agno/agno/db/mysql/mysql.py:1039-1077 | libs/agno/agno/db/postgres/postgres.py:1858-1901 | libs/agno/agno/db/singlestore/singlestore.py:1094-1133 | REDACTED:1814-1857 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (44 lines × 4) · ×1
  • Duplicated block (44 lines × 4) libs/agno/agno/workflow/step.py:1232 — libs/agno/agno/workflow/step.py:1232-1275 | libs/agno/agno/workflow/step.py:1583-1626 | libs/agno/agno/workflow/step.py:1953-1996 | libs/agno/agno/workflow/step.py:2310-2353 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: `Team` names `agno.team` in one and `agno.team.team` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (43–44 lines × 3) · ×1
  • Duplicated block (43–44 lines × 3) cookbook/02_agents/14_advanced/cancel_run.py:48 — cookbook/02_agents/14_advanced/cancel_run.py:48-91 | cookbook/03_teams/14_run_control/cancel_run.py:54-96 | cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py:54-96 — before extracting anything, compare `cookbook/02_agents/14_advanced/cancel_run.py` and `cookbook/03_teams/14_run_control/cancel_run.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) libs/agno/agno/db/dynamo/dynamo.py:2946 — libs/agno/agno/db/dynamo/dynamo.py:2946-2989 | libs/agno/agno/db/firestore/firestore.py:2517-2560 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (41–44 lines × 2) · ×1
  • Duplicated block (41–44 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:77 — libs/agno/agno/db/mysql/async_mysql.py:77-120 | libs/agno/agno/db/singlestore/singlestore.py:77-117 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` as WHOLE FILES: this scan already matched 75 separate duplicated blocks between them, totalling at least 1138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (43–44 lines × 2) · ×1
  • Duplicated block (43–44 lines × 2) libs/agno/agno/db/postgres/postgres.py:5913 — libs/agno/agno/db/postgres/postgres.py:5913-5955 | REDACTED:5702-5745 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5913` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–44 lines × 2) · ×1
  • Duplicated block (19–44 lines × 2) libs/agno/agno/os/utils.py:1556 — libs/agno/agno/os/utils.py:1556-1599 | libs/agno/agno/os/utils.py:1646-1664 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (39–44 lines × 2) · ×1
  • Duplicated block (39–44 lines × 2) libs/agno/agno/run/approval.py:364 — libs/agno/agno/run/approval.py:364-407 | libs/agno/agno/run/approval.py:875-913 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (41–43 lines × 4) · ×1
  • Duplicated block (41–43 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3655 — libs/agno/agno/db/postgres/async_postgres.py:3655-3697 | libs/agno/agno/db/postgres/postgres.py:4196-4238 | REDACTED:3804-3844 | REDACTED:4004-4044 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–43 lines × 4) · ×1
  • Duplicated block (31–43 lines × 4) libs/agno/agno/db/postgres/postgres.py:5885 — libs/agno/agno/db/postgres/postgres.py:5885-5926 | libs/agno/agno/db/postgres/postgres.py:6163-6196 | REDACTED:5674-5716 | REDACTED:5952-5982 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5885` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (38–43 lines × 3) · ×1
  • Duplicated block (38–43 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1046 — libs/agno/agno/db/mysql/async_mysql.py:1046-1083 | libs/agno/agno/db/postgres/async_postgres.py:1627-1669 | REDACTED:1557-1599 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (30–43 lines × 2) · ×1
  • Duplicated block (30–43 lines × 2) cookbook/02_agents/12_multimodal/media_input_for_tool.py:29 — cookbook/02_agents/12_multimodal/media_input_for_tool.py:29-71 | cookbook/03_teams/19_multimodal/media_input_for_tool.py:25-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (39–43 lines × 2) · ×1
  • Duplicated block (39–43 lines × 2) libs/agno/agno/tools/shopify.py:378 — libs/agno/agno/tools/shopify.py:378-416 | libs/agno/agno/tools/shopify.py:801-843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (41–42 lines × 4) · ×1
  • Duplicated block (41–42 lines × 4) libs/agno/agno/agent/_messages.py:1103 — libs/agno/agno/agent/_messages.py:1103-1144 | libs/agno/agno/agent/_messages.py:1403-1444 | libs/agno/agno/team/_messages.py:616-656 | libs/agno/agno/team/_messages.py:871-912 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_messages.py:1400` calls `has_async_db`, `aget_user_memories` and `libs/agno/agno/agent/_messages.py:1101` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (39–42 lines × 2) · ×1
  • Duplicated block (39–42 lines × 2) libs/agno/agno/agent/_run.py:3007 — libs/agno/agno/agent/_run.py:3007-3045 | libs/agno/agno/team/_run.py:6962-7003 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `run_response` to `RunOutput` in one and `"TeamRunOutput"` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–42 lines × 2) · ×1
  • Duplicated block (16–42 lines × 2) libs/agno/agno/os/utils.py:1848 — libs/agno/agno/os/utils.py:1848-1889 | libs/agno/agno/os/utils.py:1933-1948 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (36–41 lines × 3) · ×1
  • Duplicated block (36–41 lines × 3) cookbook/02_agents/14_advanced/cancel_run.py:155 — cookbook/02_agents/14_advanced/cancel_run.py:155-195 | cookbook/03_teams/14_run_control/cancel_run.py:162-197 | cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py:166-203 — before extracting anything, compare `cookbook/02_agents/14_advanced/cancel_run.py` and `cookbook/03_teams/14_run_control/cancel_run.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/14_advanced/cancel_run.py:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (41 lines × 3) · ×1
  • Duplicated block (41 lines × 3) libs/agno_infra/agno/aws/resources.py:177 — libs/agno_infra/agno/aws/resources.py:177-217 | libs/agno_infra/agno/aws/resources.py:332-372 | libs/agno_infra/agno/aws/resources.py:480-520 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–41 lines × 2) · ×1
  • Duplicated block (31–41 lines × 2) cookbook/02_agents/20_time_travel/01_continue_from.py:81 — cookbook/02_agents/20_time_travel/01_continue_from.py:81-111 | cookbook/02_agents/20_time_travel/02_fork_run.py:63-103 — before extracting anything, compare `cookbook/02_agents/20_time_travel/01_continue_from.py` and `cookbook/02_agents/20_time_travel/02_fork_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/20_time_travel/02_fork_run.py:63` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (38–41 lines × 2) · ×1
  • Duplicated block (38–41 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1843 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1843-1883 | libs/agno/agno/db/json/json_db.py:1943-1980 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27–41 lines × 2) · ×1
  • Duplicated block (27–41 lines × 2) libs/agno/agno/os/routers/agents/router.py:1751 — libs/agno/agno/os/routers/agents/router.py:1751-1791 | libs/agno/agno/os/routers/teams/router.py:1704-1730 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1751` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (40–41 lines × 2) · ×1
  • Duplicated block (40–41 lines × 2) libs/agno/agno/team/_run.py:687 — libs/agno/agno/team/_run.py:687-726 | libs/agno/agno/team/_run.py:1589-1629 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:687` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (40 lines × 3) · ×1
  • Duplicated block (40 lines × 3) REDACTED:149 — REDACTED:149-188 | REDACTED:488-527 | REDACTED:705-744 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (39–40 lines × 3) · ×1
  • Duplicated block (39–40 lines × 3) libs/agno/agno/db/mysql/mysql.py:786 — libs/agno/agno/db/mysql/mysql.py:786-824 | libs/agno/agno/db/singlestore/singlestore.py:842-880 | REDACTED:1277-1316 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (38–40 lines × 2) · ×1
  • Duplicated block (38–40 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:1378 — libs/agno/agno/db/mongo/async_mongo.py:1378-1415 | libs/agno/agno/db/mongo/mongo.py:1186-1225 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (34–40 lines × 2) · ×1
  • Duplicated block (34–40 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:946 — libs/agno/agno/db/mysql/async_mysql.py:946-979 | libs/agno/agno/db/postgres/async_postgres.py:1520-1559 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35–39 lines × 4) · ×1
  • Duplicated block (35–39 lines × 4) libs/agno/agno/tools/spotify.py:207 — libs/agno/agno/tools/spotify.py:207-243 | libs/agno/agno/tools/spotify.py:297-331 | libs/agno/agno/tools/spotify.py:342-379 | libs/agno/agno/tools/spotify.py:658-696 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/spotify.py:207` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `max_results` to `int = 10` in one and `int = 5` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (39 lines × 3) · ×1
  • Duplicated block (39 lines × 3) libs/agno/agno/db/gcs_json/utils.py:112 — libs/agno/agno/db/gcs_json/utils.py:112-150 | libs/agno/agno/db/in_memory/utils.py:112-150 | libs/agno/agno/db/json/utils.py:112-150 — `libs/agno/agno/db/gcs_json/utils.py` and `libs/agno/agno/db/in_memory/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 176 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (33–39 lines × 3) · ×1
  • Duplicated block (33–39 lines × 3) libs/agno/agno/db/mysql/mysql.py:942 — libs/agno/agno/db/mysql/mysql.py:942-974 | libs/agno/agno/db/postgres/postgres.py:1754-1792 | libs/agno/agno/db/singlestore/singlestore.py:997-1029 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (38–39 lines × 3) · ×1
  • Duplicated block (38–39 lines × 3) libs/agno/agno/workflow/step.py:1493 — libs/agno/agno/workflow/step.py:1493-1530 | libs/agno/agno/workflow/step.py:2154-2192 | libs/agno/agno/workflow/step.py:2218-2256 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/step.py:1535` calls `merge_dictionaries` and `libs/agno/agno/workflow/step.py:2194` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25–39 lines × 2) · ×1
  • Duplicated block (25–39 lines × 2) libs/agno/agno/agent/_run.py:3185 — libs/agno/agno/agent/_run.py:3185-3223 | libs/agno/agno/team/_run.py:7138-7162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (37–39 lines × 2) · ×1
  • Duplicated block (37–39 lines × 2) REDACTED:2338 — REDACTED:2338-2376 | REDACTED:3040-3076 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–37 lines × 3) · ×1
  • Duplicated block (12–37 lines × 3) libs/agno/agno/db/firestore/firestore.py:427 — libs/agno/agno/db/firestore/firestore.py:427-438 | libs/agno/agno/db/firestore/firestore.py:1296-1328 | libs/agno/agno/db/firestore/firestore.py:2047-2083 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/firestore/firestore.py:1331` calls `where`, `FieldFilter` and `libs/agno/agno/db/firestore/firestore.py:440` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (34–37 lines × 2) · ×1
  • Duplicated block (34–37 lines × 2) libs/agno/agno/knowledge/loaders/s3.py:98 — libs/agno/agno/knowledge/loaders/s3.py:98-131 | libs/agno/agno/knowledge/loaders/s3.py:191-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/loaders/s3.py:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/knowledge/loaders/s3.py:95` calls `log_error` and `libs/agno/agno/knowledge/loaders/s3.py:191` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14–37 lines × 2) · ×1
  • Duplicated block (14–37 lines × 2) libs/agno/agno/os/utils.py:1711 — libs/agno/agno/os/utils.py:1711-1747 | libs/agno/agno/os/utils.py:1791-1804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (33–36 lines × 8) · ×1
  • Duplicated block (33–36 lines × 8) libs/agno/agno/db/mysql/mysql.py:1683 — libs/agno/agno/db/mysql/mysql.py:1683-1715 | libs/agno/agno/db/mysql/mysql.py:2589-2624 | libs/agno/agno/db/postgres/postgres.py:2558-2590 | libs/agno/agno/db/postgres/postgres.py:3536-3571 | libs/agno/agno/db/singlestore/singlestore.py:1722-1754 | libs/agno/agno/db/singlestore/singlestore.py:2585-2620 | REDACTED:2479-2512 | REDACTED:3396-3431 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–36 lines × 6) · ×1
  • Duplicated block (32–36 lines × 6) libs/agno/agno/db/mysql/async_mysql.py:1703 — libs/agno/agno/db/mysql/async_mysql.py:1703-1734 | libs/agno/agno/db/mysql/async_mysql.py:2621-2655 | libs/agno/agno/db/postgres/async_postgres.py:2102-2133 | libs/agno/agno/db/postgres/async_postgres.py:2993-3027 | REDACTED:2222-2255 | REDACTED:3143-3178 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (36 lines × 4) · ×1
  • Duplicated block (36 lines × 4) libs/agno/agno/utils/print_response/workflow.py:75 — libs/agno/agno/utils/print_response/workflow.py:75-110 | libs/agno/agno/utils/print_response/workflow.py:223-258 | libs/agno/agno/utils/print_response/workflow.py:936-971 | libs/agno/agno/utils/print_response/workflow.py:1084-1119 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/workflow.py:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (36 lines × 3) · ×1
  • Duplicated block (36 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:3304 — libs/agno/agno/db/mysql/async_mysql.py:3304-3339 | libs/agno/agno/db/postgres/async_postgres.py:3790-3825 | REDACTED:3921-3956 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35–36 lines × 3) · ×1
  • Duplicated block (35–36 lines × 3) libs/agno/agno/os/interfaces/a2a/router.py:322 — libs/agno/agno/os/interfaces/a2a/router.py:322-356 | libs/agno/agno/os/interfaces/a2a/router.py:649-683 | libs/agno/agno/os/interfaces/a2a/router.py:859-894 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/router.py:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (35 lines × 7) · ×1
  • Duplicated block (35 lines × 7) libs/agno/agno/db/mongo/mongo.py:2321 — libs/agno/agno/db/mongo/mongo.py:2321-2355 | libs/agno/agno/db/mysql/async_mysql.py:2771-2805 | libs/agno/agno/db/mysql/mysql.py:2738-2772 | libs/agno/agno/db/postgres/async_postgres.py:3145-3179 | libs/agno/agno/db/postgres/postgres.py:3689-3723 | REDACTED:3297-3331 | REDACTED:4303-4337 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35 lines × 4) · ×1
  • Duplicated block (35 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3601 — libs/agno/agno/db/postgres/async_postgres.py:3601-3635 | libs/agno/agno/db/postgres/postgres.py:4143-4177 | REDACTED:3750-3784 | REDACTED:3949-3983 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3601` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:3598` calls `percentile_cont`, `within_group`, `label` and `REDACTED:3747` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (34–35 lines × 4) · ×1
  • Duplicated block (34–35 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:7109 — libs/agno/agno/db/postgres/async_postgres.py:7109-7142 | libs/agno/agno/db/postgres/postgres.py:9835-9869 | REDACTED:6278-6311 | REDACTED:8764-8798 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:7109` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–35 lines × 4) · ×1
  • Duplicated block (32–35 lines × 4) libs/agno/agno/utils/print_response/agent.py:604 — libs/agno/agno/utils/print_response/agent.py:604-635 | libs/agno/agno/utils/print_response/agent.py:724-755 | libs/agno/agno/utils/print_response/team.py:85-119 | libs/agno/agno/utils/print_response/team.py:1020-1054 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/utils/print_response/agent.py:604` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27–35 lines × 3) · ×1
  • Duplicated block (27–35 lines × 3) libs/agno/agno/tools/anakin.py:112 — libs/agno/agno/tools/anakin.py:112-138 | libs/agno/agno/tools/anakin.py:151-183 | libs/agno/agno/tools/anakin.py:197-231 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–35 lines × 2) · ×1
  • Duplicated block (26–35 lines × 2) libs/agno/agno/offload/runs.py:36 — libs/agno/agno/offload/runs.py:36-70 | libs/agno/agno/offload/runs.py:109-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–35 lines × 2) · ×1
  • Duplicated block (23–35 lines × 2) libs/agno/agno/os/middleware/jwt.py:861 — libs/agno/agno/os/middleware/jwt.py:861-895 | libs/agno/agno/os/middleware/jwt.py:941-963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32–35 lines × 2) · ×1
  • Duplicated block (32–35 lines × 2) libs/agno/agno/team/_run.py:1262 — libs/agno/agno/team/_run.py:1262-1296 | libs/agno/agno/team/_run.py:8228-8259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:1262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (26–34 lines × 4) · ×1
  • Duplicated block (26–34 lines × 4) libs/agno/agno/tools/shopify.py:376 — libs/agno/agno/tools/shopify.py:376-405 | libs/agno/agno/tools/shopify.py:480-505 | libs/agno/agno/tools/shopify.py:799-832 | libs/agno/agno/tools/shopify.py:1436-1467 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/shopify.py:376` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31–34 lines × 4) · ×1
  • Duplicated block (31–34 lines × 4) libs/agno/agno/workflow/workflow.py:3554 — libs/agno/agno/workflow/workflow.py:3554-3587 | libs/agno/agno/workflow/workflow.py:4597-4630 | libs/agno/agno/workflow/workflow.py:8390-8420 | libs/agno/agno/workflow/workflow.py:10150-10180 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3554` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:4596` calls `RunCancelledException` and `libs/agno/agno/workflow/workflow.py:3553` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (33–34 lines × 3) · ×1
  • Duplicated block (33–34 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1797 — libs/agno/agno/db/mysql/async_mysql.py:1797-1829 | libs/agno/agno/db/postgres/async_postgres.py:2193-2226 | REDACTED:2300-2333 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (25–34 lines × 2) · ×1
  • Duplicated block (25–34 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:284 — libs/agno/agno/db/gcs_json/gcs_json_db.py:284-308 | libs/agno/agno/db/json/json_db.py:311-344 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–34 lines × 2) · ×1
  • Duplicated block (23–34 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:1378 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1378-1400 | libs/agno/agno/db/json/json_db.py:1460-1493 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–34 lines × 2) · ×1
  • Duplicated block (26–34 lines × 2) libs/agno/agno/os/routers/session/session.py:743 — libs/agno/agno/os/routers/session/session.py:743-768 | libs/agno/agno/os/routers/session/session.py:782-815 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/session/session.py:743` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30–33 lines × 6) · ×1
  • Duplicated block (30–33 lines × 6) libs/agno/agno/db/dynamo/dynamo.py:1099 — libs/agno/agno/db/dynamo/dynamo.py:1099-1131 | libs/agno/agno/db/firestore/firestore.py:1071-1103 | libs/agno/agno/db/gcs_json/gcs_json_db.py:748-780 | libs/agno/agno/db/in_memory/in_memory_db.py:432-461 | libs/agno/agno/db/json/json_db.py:801-833 | libs/agno/agno/db/redis/redis.py:971-1003 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–33 lines × 6) · ×1
  • Duplicated block (31–33 lines × 6) libs/agno/agno/db/dynamo/dynamo.py:1551 — libs/agno/agno/db/dynamo/dynamo.py:1551-1583 | libs/agno/agno/db/firestore/firestore.py:1474-1505 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1048-1079 | libs/agno/agno/db/in_memory/in_memory_db.py:891-921 | libs/agno/agno/db/json/json_db.py:1115-1146 | libs/agno/agno/db/redis/redis.py:1307-1339 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–33 lines × 4) · ×1
  • Duplicated block (31–33 lines × 4) libs/agno/agno/db/mysql/mysql.py:1531 — libs/agno/agno/db/mysql/mysql.py:1531-1561 | libs/agno/agno/db/postgres/postgres.py:2382-2414 | libs/agno/agno/db/singlestore/singlestore.py:1575-1605 | REDACTED:2324-2354 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28–33 lines × 4) · ×1
  • Duplicated block (28–33 lines × 4) libs/agno/agno/os/routers/agents/router.py:2242 — libs/agno/agno/os/routers/agents/router.py:2242-2274 | libs/agno/agno/os/routers/agents/router.py:2340-2367 | libs/agno/agno/os/routers/agents/router.py:2405-2432 | libs/agno/agno/os/routers/agents/router.py:2592-2622 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/routers/agents/router.py:2624` calls `HTTPException` and `libs/agno/agno/os/routers/agents/router.py:2368` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (33 lines × 3) · ×1
  • Duplicated block (33 lines × 3) libs/agno/agno/os/routers/agents/router.py:2446 — libs/agno/agno/os/routers/agents/router.py:2446-2478 | libs/agno/agno/os/routers/teams/router.py:1242-1274 | libs/agno/agno/os/routers/workflows/router.py:2661-2693 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2446` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31–33 lines × 3) · ×1
  • Duplicated block (31–33 lines × 3) libs/agno/agno/tools/visualization.py:103 — libs/agno/agno/tools/visualization.py:103-135 | libs/agno/agno/tools/visualization.py:175-207 | libs/agno/agno/tools/visualization.py:246-276 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (31–33 lines × 2) · ×1
  • Duplicated block (31–33 lines × 2) libs/agno/agno/db/postgres/async_postgres.py:3936 — libs/agno/agno/db/postgres/async_postgres.py:3936-3968 | REDACTED:4069-4099 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (30–33 lines × 2) · ×1
  • Duplicated block (30–33 lines × 2) libs/agno/agno/db/redis/redis.py:1008 — libs/agno/agno/db/redis/redis.py:1008-1040 | libs/agno/agno/db/valkey/valkey.py:1275-1304 — `libs/agno/agno/db/redis/redis.py` and `libs/agno/agno/db/valkey/valkey.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 65 separate duplicated blocks between them, totalling at least 1573 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–33 lines × 2) · ×1
  • Duplicated block (15–33 lines × 2) libs/agno/agno/os/utils.py:1414 — libs/agno/agno/os/utils.py:1414-1446 | libs/agno/agno/os/utils.py:1455-1469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (32 lines × 4) · ×1
  • Duplicated block (32 lines × 4) libs/agno/agno/agent/_hooks.py:173 — libs/agno/agno/agent/_hooks.py:173-204 | libs/agno/agno/agent/_hooks.py:382-413 | libs/agno/agno/team/_hooks.py:359-390 | libs/agno/agno/team/_hooks.py:556-587 — `libs/agno/agno/agent/_hooks.py` and `libs/agno/agno/team/_hooks.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 106 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (22–32 lines × 4) · ×1
  • Duplicated block (22–32 lines × 4) libs/agno/agno/os/routers/agents/router.py:1915 — libs/agno/agno/os/routers/agents/router.py:1915-1936 | libs/agno/agno/os/routers/agents/router.py:2446-2477 | libs/agno/agno/os/routers/teams/router.py:1242-1273 | libs/agno/agno/os/routers/workflows/router.py:2661-2692 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:1915` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (30–32 lines × 3) · ×1
  • Duplicated block (30–32 lines × 3) libs/agno/agno/agent/_session.py:370 — libs/agno/agno/agent/_session.py:370-399 | libs/agno/agno/team/_session.py:797-826 | libs/agno/agno/workflow/workflow.py:1178-1209 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/agent/_session.py:367` calls `has_async_db`, `ValueError` and `libs/agno/agno/team/_session.py:795` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–32 lines × 3) · ×1
  • Duplicated block (13–32 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:749 — libs/agno/agno/db/mysql/async_mysql.py:749-761 | libs/agno/agno/db/postgres/async_postgres.py:1069-1100 | REDACTED:1020-1051 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (30–32 lines × 2) · ×1
  • Duplicated block (30–32 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:460 — libs/agno/agno/db/gcs_json/gcs_json_db.py:460-489 | libs/agno/agno/db/json/json_db.py:507-538 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (26–32 lines × 2) · ×1
  • Duplicated block (26–32 lines × 2) libs/agno/agno/knowledge/reader/website_reader.py:156 — libs/agno/agno/knowledge/reader/website_reader.py:156-187 | libs/agno/agno/knowledge/reader/website_reader.py:291-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–32 lines × 2) · ×1
  • Duplicated block (23–32 lines × 2) REDACTED:664 — REDACTED:664-695 | REDACTED:897-919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–32 lines × 2) · ×1
  • Duplicated block (15–32 lines × 2) libs/agno/agno/run/status_persist.py:261 — libs/agno/agno/run/status_persist.py:261-292 | libs/agno/agno/run/status_persist.py:344-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–32 lines × 2) · ×1
  • Duplicated block (19–32 lines × 2) libs/agno_infra/agno/docker/resources.py:240 — libs/agno_infra/agno/docker/resources.py:240-271 | libs/agno_infra/agno/docker/resources.py:418-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/docker/resources.py:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29–31 lines × 3) · ×1
  • Duplicated block (29–31 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:986 — libs/agno/agno/db/mysql/async_mysql.py:986-1014 | libs/agno/agno/db/postgres/async_postgres.py:1566-1594 | REDACTED:1494-1524 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (27–31 lines × 3) · ×1
  • Duplicated block (27–31 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1550 — libs/agno/agno/db/mysql/async_mysql.py:1550-1576 | libs/agno/agno/db/postgres/async_postgres.py:1931-1957 | REDACTED:2067-2097 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31 lines × 3) · ×1
  • Duplicated block (31 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2343 — libs/agno/agno/db/mysql/async_mysql.py:2343-2373 | libs/agno/agno/db/postgres/async_postgres.py:2689-2719 | REDACTED:2889-2919 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–31 lines × 2) · ×1
  • Duplicated block (17–31 lines × 2) libs/agno/agno/agent/_messages.py:2533 — libs/agno/agno/agent/_messages.py:2533-2563 | libs/agno/agno/agent/_messages.py:2656-2672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_messages.py:2533` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–31 lines × 2) · ×1
  • Duplicated block (26–31 lines × 2) libs/agno/agno/db/mysql/async_mysql.py:1193 — libs/agno/agno/db/mysql/async_mysql.py:1193-1218 | libs/agno/agno/db/postgres/async_postgres.py:1784-1814 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:1784` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–31 lines × 2) · ×1
  • Duplicated block (9–31 lines × 2) libs/agno/agno/knowledge/knowledge.py:876 — libs/agno/agno/knowledge/knowledge.py:876-884 | libs/agno/agno/knowledge/knowledge.py:1023-1053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (25–31 lines × 2) · ×1
  • Duplicated block (25–31 lines × 2) libs/agno/agno/learn/stores/user_profile.py:388 — libs/agno/agno/learn/stores/user_profile.py:388-418 | libs/agno/agno/learn/stores/user_profile.py:476-500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6–31 lines × 2) · ×1
  • Duplicated block (6–31 lines × 2) libs/agno/agno/os/routers/knowledge/knowledge.py:565 — libs/agno/agno/os/routers/knowledge/knowledge.py:565-570 | libs/agno/agno/os/routers/memory/memory.py:548-578 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/knowledge/knowledge.py:565` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/os/routers/knowledge/knowledge.py:571` calls `Query` and `libs/agno/agno/os/routers/memory/memory.py:579` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (27–31 lines × 2) · ×1
  • Duplicated block (27–31 lines × 2) libs/agno/agno/os/routers/workflows/router.py:1948 — libs/agno/agno/os/routers/workflows/router.py:1948-1974 | libs/agno/agno/os/routers/workflows/router.py:2058-2088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (29–30 lines × 5) · ×1
  • Duplicated block (29–30 lines × 5) libs/agno/agno/db/mongo/utils.py:207 — libs/agno/agno/db/mongo/utils.py:207-235 | libs/agno/agno/db/mysql/utils.py:302-330 | libs/agno/agno/db/postgres/utils.py:353-382 | libs/agno/agno/db/singlestore/utils.py:329-357 | libs/agno/agno/db/sqlite/utils.py:318-347 — `libs/agno/agno/db/mongo/utils.py` and `libs/agno/agno/db/mysql/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 159 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (30 lines × 4) · ×1
  • Duplicated block (30 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3568 — libs/agno/agno/db/postgres/async_postgres.py:3568-3597 | libs/agno/agno/db/postgres/postgres.py:4110-4139 | REDACTED:3718-3747 | REDACTED:3917-3946 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:3568` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:3598` calls `percentile_cont`, `within_group`, `label` and `REDACTED:3748` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (21–30 lines × 3) · ×1
  • Duplicated block (21–30 lines × 3) libs/agno/agno/agent/_storage.py:1701 — libs/agno/agno/agent/_storage.py:1701-1730 | libs/agno/agno/team/_storage.py:1670-1698 | libs/agno/agno/workflow/workflow.py:1572-1592 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–30 lines × 2) · ×1
  • Duplicated block (14–30 lines × 2) libs/agno/agno/db/redis/redis.py:3128 — libs/agno/agno/db/redis/redis.py:3128-3141 | libs/agno/agno/db/redis/redis.py:3168-3197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16–30 lines × 2) · ×1
  • Duplicated block (16–30 lines × 2) libs/agno/agno/knowledge/knowledge.py:3393 — libs/agno/agno/knowledge/knowledge.py:3393-3422 | libs/agno/agno/knowledge/knowledge.py:3606-3621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24–30 lines × 2) · ×1
  • Duplicated block (24–30 lines × 2) libs/agno/agno/knowledge/knowledge.py:4191 — libs/agno/agno/knowledge/knowledge.py:4191-4220 | libs/agno/agno/knowledge/knowledge.py:4269-4292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (29 lines × 10) · ×1
  • Duplicated block (29 lines × 10) libs/agno/agno/db/mysql/async_mysql.py:1427 — libs/agno/agno/db/mysql/async_mysql.py:1427-1455 | libs/agno/agno/db/mysql/async_mysql.py:1478-1506 | libs/agno/agno/db/mysql/mysql.py:1410-1438 | libs/agno/agno/db/mysql/mysql.py:1460-1488 | libs/agno/agno/db/singlestore/singlestore.py:1461-1489 | libs/agno/agno/db/singlestore/singlestore.py:1511-1539 | REDACTED:1925-1953 | REDACTED:1985-2013 | REDACTED:2182-2210 | REDACTED:2242-2270 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–29 lines × 6) · ×1
  • Duplicated block (26–29 lines × 6) libs/agno/agno/tools/memory.py:67 — libs/agno/agno/tools/memory.py:67-95 | libs/agno/agno/tools/memory.py:310-336 | libs/agno/agno/tools/workflow.py:70-96 | libs/agno/agno/tools/workflow.py:99-125 | libs/agno/agno/tools/workflow.py:207-232 | libs/agno/agno/tools/workflow.py:235-260 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (28–29 lines × 6) · ×1
  • Duplicated block (28–29 lines × 6) libs/agno/agno/workflow/condition.py:848 — libs/agno/agno/workflow/condition.py:848-875 | libs/agno/agno/workflow/condition.py:1302-1329 | libs/agno/agno/workflow/router.py:877-904 | libs/agno/agno/workflow/router.py:1218-1245 | libs/agno/agno/workflow/steps.py:476-504 | libs/agno/agno/workflow/steps.py:781-809 — before extracting anything, compare `libs/agno/agno/workflow/condition.py` and `libs/agno/agno/workflow/router.py` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 321 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:848` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25–29 lines × 5) · ×1
  • Duplicated block (25–29 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:1969 — libs/agno/agno/db/mysql/async_mysql.py:1969-1995 | libs/agno/agno/db/mysql/mysql.py:1939-1967 | libs/agno/agno/db/singlestore/singlestore.py:1960-1984 | REDACTED:2472-2499 | REDACTED:2727-2754 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1969` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–29 lines × 5) · ×1
  • Duplicated block (23–29 lines × 5) libs/agno/agno/tools/shopify.py:375 — libs/agno/agno/tools/shopify.py:375-400 | libs/agno/agno/tools/shopify.py:479-501 | libs/agno/agno/tools/shopify.py:798-826 | libs/agno/agno/tools/shopify.py:1329-1352 | libs/agno/agno/tools/shopify.py:1435-1463 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/shopify.py:375` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (25–29 lines × 4) · ×1
  • Duplicated block (25–29 lines × 4) libs/agno/agno/agent/_hooks.py:56 — libs/agno/agno/agent/_hooks.py:56-84 | libs/agno/agno/agent/_hooks.py:167-191 | libs/agno/agno/agent/_hooks.py:274-299 | libs/agno/agno/agent/_hooks.py:375-400 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_hooks.py:192` calls `iscoroutinefunction`, `hook` and `libs/agno/agno/agent/_hooks.py:85` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (27–29 lines × 4) · ×1
  • Duplicated block (27–29 lines × 4) libs/agno/agno/db/postgres/async_postgres.py:3942 — libs/agno/agno/db/postgres/async_postgres.py:3942-3970 | libs/agno/agno/db/postgres/postgres.py:4480-4508 | REDACTED:4075-4101 | REDACTED:4270-4296 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–29 lines × 4) · ×1
  • Duplicated block (26–29 lines × 4) REDACTED:971 — REDACTED:971-999 | REDACTED:1018-1043 | REDACTED:1071-1096 | REDACTED:1169-1194 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:971` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29 lines × 4) · ×1
  • Duplicated block (29 lines × 4) libs/agno/agno/workflow/condition.py:618 — libs/agno/agno/workflow/condition.py:618-646 | libs/agno/agno/workflow/condition.py:873-901 | libs/agno/agno/workflow/condition.py:1071-1099 | libs/agno/agno/workflow/condition.py:1327-1355 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/condition.py:615` calls `getattr`, `log_debug` and `libs/agno/agno/workflow/condition.py:871` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18–29 lines × 2) · ×1
  • Duplicated block (18–29 lines × 2) libs/agno/agno/agent/_session.py:544 — libs/agno/agno/agent/_session.py:544-572 | libs/agno/agno/team/_session.py:500-517 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `session` to `AgentSession` in one and `TeamSession` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (24–29 lines × 2) · ×1
  • Duplicated block (24–29 lines × 2) libs/agno/agno/db/mongo/async_mongo.py:3798 — libs/agno/agno/db/mongo/async_mongo.py:3798-3826 | libs/agno/agno/db/mongo/mongo.py:3596-3619 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–29 lines × 4) · ×1
  • Duplicated block (3–29 lines × 4) libs/agno/agno/os/routers/memory/memory.py:145 — libs/agno/agno/os/routers/memory/memory.py:145-159 | libs/agno/agno/os/routers/memory/memory.py:330-358 | libs/agno/agno/os/routers/memory/memory.py:579-581 | libs/agno/agno/os/routers/metrics/metrics.py:111-116 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/memory/memory.py:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–29 lines × 2) · ×1
  • Duplicated block (20–29 lines × 2) libs/agno/agno/tools/google/calendar.py:172 — libs/agno/agno/tools/google/calendar.py:172-191 | libs/agno/agno/tools/google/gmail.py:326-354 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (26–28 lines × 4) · ×1
  • Duplicated block (26–28 lines × 4) libs/agno/agno/os/routers/teams/router.py:2128 — libs/agno/agno/os/routers/teams/router.py:2128-2153 | libs/agno/agno/os/routers/teams/router.py:2223-2248 | libs/agno/agno/os/routers/teams/router.py:2288-2313 | libs/agno/agno/os/routers/teams/router.py:2353-2380 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (25–28 lines × 4) · ×1
  • Duplicated block (25–28 lines × 4) libs/agno/agno/workflow/condition.py:342 — libs/agno/agno/workflow/condition.py:342-368 | libs/agno/agno/workflow/loop.py:393-420 | libs/agno/agno/workflow/router.py:438-462 | libs/agno/agno/workflow/steps.py:216-242 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21–28 lines × 4) · ×1
  • Duplicated block (21–28 lines × 4) libs/agno/agno/workflow/workflow.py:3048 — libs/agno/agno/workflow/workflow.py:3048-3072 | libs/agno/agno/workflow/workflow.py:4053-4080 | libs/agno/agno/workflow/workflow.py:7346-7368 | libs/agno/agno/workflow/workflow.py:9396-9416 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3048` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (26–28 lines × 3) · ×1
  • Duplicated block (26–28 lines × 3) libs/agno/agno/agent/agent.py:1984 — libs/agno/agno/agent/agent.py:1984-2009 | libs/agno/agno/team/team.py:2027-2052 | libs/agno/agno/workflow/workflow.py:12057-12084 — `libs/agno/agno/agent/agent.py` and `libs/agno/agno/team/team.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/agent.py:1984` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–28 lines × 2) · ×1
  • Duplicated block (14–28 lines × 2) cookbook/02_agents/15_dependencies/dependencies_in_tools.py:25 — cookbook/02_agents/15_dependencies/dependencies_in_tools.py:25-52 | cookbook/03_teams/17_dependencies/dependencies_in_tools.py:47-60 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–28 lines × 2) · ×1
  • Duplicated block (22–28 lines × 2) libs/agno/agno/learn/stores/entity_memory.py:1106 — libs/agno/agno/learn/stores/entity_memory.py:1106-1127 | libs/agno/agno/learn/stores/entity_memory.py:1226-1253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/learn/stores/entity_memory.py:1106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–28 lines × 2) · ×1
  • Duplicated block (10–28 lines × 2) libs/agno/agno/tools/shopify.py:190 — libs/agno/agno/tools/shopify.py:190-199 | libs/agno/agno/tools/shopify.py:1070-1097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/shopify.py:190` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20–28 lines × 2) · ×1
  • Duplicated block (20–28 lines × 2) libs/agno/agno/vectordb/redis/redisdb.py:155 — libs/agno/agno/vectordb/redis/redisdb.py:155-174 | libs/agno/agno/vectordb/valkey/valkeydb.py:274-301 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/vectordb/valkey/valkeydb.py:303` calls `ValueError` and `libs/agno/agno/vectordb/redis/redisdb.py:175` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–27 lines × 12) · ×1
  • Duplicated block (9–27 lines × 12) libs/agno/agno/db/dynamo/utils.py:473 — libs/agno/agno/db/dynamo/utils.py:473-494 | libs/agno/agno/db/firestore/utils.py:303-311 | libs/agno/agno/db/in_memory/utils.py:156-182 | libs/agno/agno/db/json/utils.py:156-182 | libs/agno/agno/db/mongo/utils.py:241-249 | libs/agno/agno/db/mysql/utils.py:336-360 | libs/agno/agno/db/postgres/utils.py:388-412 | libs/agno/agno/db/redis/utils.py:302-319 | libs/agno/agno/db/singlestore/utils.py:363-387 | libs/agno/agno/db/sqlite/utils.py:353-377 | libs/agno/agno/db/surrealdb/metrics.py:227-253 | libs/agno/agno/db/valkey/utils.py:497-514 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27 lines × 6) · ×1
  • Duplicated block (27 lines × 6) REDACTED:139 — REDACTED:139-165 | REDACTED:478-504 | REDACTED:695-721 | REDACTED:778-804 | REDACTED:851-877 | REDACTED:933-959 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–27 lines × 3) · ×1
  • Duplicated block (26–27 lines × 3) libs/agno/agno/db/mysql/mysql.py:1212 — libs/agno/agno/db/mysql/mysql.py:1212-1237 | libs/agno/agno/db/singlestore/singlestore.py:1270-1295 | REDACTED:1971-1997 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/mysql.py:1212` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–27 lines × 3) · ×1
  • Duplicated block (24–27 lines × 3) libs/agno/agno/db/mysql/mysql.py:2677 — libs/agno/agno/db/mysql/mysql.py:2677-2700 | libs/agno/agno/db/singlestore/singlestore.py:2673-2696 | REDACTED:3483-3509 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/singlestore/singlestore.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 153 separate duplicated blocks between them, totalling at least 2727 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/singlestore/singlestore.py:2701` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:2704` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14–27 lines × 3) · ×1
  • Duplicated block (14–27 lines × 3) libs/agno/agno/models/aws/claude.py:236 — libs/agno/agno/models/aws/claude.py:236-262 | libs/agno/agno/models/azure/claude.py:164-177 | libs/agno/agno/models/vertexai/claude.py:159-185 — `libs/agno/agno/models/aws/claude.py` and `libs/agno/agno/models/azure/claude.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 64 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `response_format` to `Optional[Union[Dict, Type[BaseModel]]] = None` in one and `Union[Dict, Type[BaseModel]] | None = None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (27 lines × 3) · ×1
  • Duplicated block (27 lines × 3) libs/agno/agno/session/agent.py:151 — libs/agno/agno/session/agent.py:151-178 | libs/agno/agno/session/team.py:141-168 | libs/agno/agno/session/workflow.py:239-265 — before extracting anything, compare `libs/agno/agno/session/agent.py` and `libs/agno/agno/session/team.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 137 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/session/team.py:171` calls `log_debug` and `libs/agno/agno/session/agent.py:180` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25–27 lines × 3) · ×1
  • Duplicated block (25–27 lines × 3) libs/agno/agno/team/_run.py:7581 — libs/agno/agno/team/_run.py:7581-7605 | libs/agno/agno/team/_run.py:7824-7850 | libs/agno/agno/team/_run.py:7897-7923 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:7853` calls `_handle_team_tool_call_updates` and `libs/agno/agno/team/_run.py:7607` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20–27 lines × 2) · ×1
  • Duplicated block (20–27 lines × 2) libs/agno/agno/team/_run.py:553 — libs/agno/agno/team/_run.py:553-572 | libs/agno/agno/team/_run.py:1413-1439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–26 lines × 9) · ×1
  • Duplicated block (22–26 lines × 9) libs/agno/agno/models/dashscope/dashscope.py:43 — libs/agno/agno/models/dashscope/dashscope.py:43-67 | libs/agno/agno/models/deepseek/deepseek.py:113-138 | libs/agno/agno/models/groq/groq.py:73-94 | libs/agno/agno/models/minimax/minimax.py:38-62 | libs/agno/agno/models/moonshot/moonshot.py:105-130 | libs/agno/agno/models/n1n/n1n.py:31-56 | libs/agno/agno/models/openai/chat.py:107-131 | libs/agno/agno/models/openai/responses.py:206-230 | libs/agno/agno/models/synthorai/synthorai.py:31-56 — before extracting anything, compare `libs/agno/agno/models/deepseek/deepseek.py` and `libs/agno/agno/models/openai/chat.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (23–26 lines × 7) · ×1
  • Duplicated block (23–26 lines × 7) libs/agno/agno/db/dynamo/dynamo.py:2535 — libs/agno/agno/db/dynamo/dynamo.py:2535-2557 | libs/agno/agno/db/firestore/firestore.py:2240-2262 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1616-1638 | libs/agno/agno/db/json/json_db.py:1720-1742 | libs/agno/agno/db/redis/redis.py:1981-2006 | libs/agno/agno/db/surrealdb/surrealdb.py:1783-1805 | libs/agno/agno/db/valkey/valkey.py:2415-2440 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `agent_id` to `Any` in one and `Optional[str]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (26 lines × 6) · ×1
  • Duplicated block (26 lines × 6) REDACTED:1872 — REDACTED:1872-1897 | REDACTED:1932-1957 | REDACTED:1992-2017 | REDACTED:2129-2154 | REDACTED:2189-2214 | REDACTED:2249-2274 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 152 separate duplicated blocks between them, totalling at least 2111 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1872` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24–26 lines × 4) · ×1
  • Duplicated block (24–26 lines × 4) libs/agno/agno/eval/agent_as_judge.py:546 — libs/agno/agno/eval/agent_as_judge.py:546-569 | libs/agno/agno/eval/agent_as_judge.py:644-669 | libs/agno/agno/eval/agent_as_judge.py:714-738 | libs/agno/agno/eval/agent_as_judge.py:783-807 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/eval/agent_as_judge.py:644` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 3) · ×1
  • Duplicated block (26 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:3271 — libs/agno/agno/db/mysql/async_mysql.py:3271-3296 | libs/agno/agno/db/postgres/async_postgres.py:3757-3782 | REDACTED:3888-3913 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–26 lines × 3) · ×1
  • Duplicated block (24–26 lines × 3) libs/agno/agno/media/media.py:215 — libs/agno/agno/media/media.py:215-240 | libs/agno/agno/media/media.py:378-401 | libs/agno/agno/media/media.py:555-578 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16–26 lines × 2) · ×1
  • Duplicated block (16–26 lines × 2) libs/agno/agno/agent/_storage.py:480 — libs/agno/agno/agent/_storage.py:480-505 | libs/agno/agno/team/_storage.py:270-285 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) libs/agno/agno/workflow/workflow.py:3325 — libs/agno/agno/workflow/workflow.py:3325-3348 | libs/agno/agno/workflow/workflow.py:3775-3800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3325` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–25 lines × 11) · ×1
  • Duplicated block (21–25 lines × 11) libs/agno/agno/models/dashscope/dashscope.py:45 — libs/agno/agno/models/dashscope/dashscope.py:45-68 | libs/agno/agno/models/deepseek/deepseek.py:115-139 | libs/agno/agno/models/groq/groq.py:75-95 | libs/agno/agno/models/minimax/minimax.py:40-63 | libs/agno/agno/models/moonshot/moonshot.py:107-131 | libs/agno/agno/models/n1n/n1n.py:33-57 | libs/agno/agno/models/nebius/nebius.py:30-53 | libs/agno/agno/models/openai/chat.py:109-132 | libs/agno/agno/models/openai/responses.py:208-232 | libs/agno/agno/models/synthorai/synthorai.py:33-57 | libs/agno/agno/models/trustedrouter/trustedrouter.py:30-53 — before extracting anything, compare `libs/agno/agno/models/deepseek/deepseek.py` and `libs/agno/agno/models/openai/chat.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/models/n1n/n1n.py:32` calls `getenv` and `libs/agno/agno/models/nebius/nebius.py:29` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (24–25 lines × 8) · ×1
  • Duplicated block (24–25 lines × 8) libs/agno/agno/reasoning/azure_ai_foundry.py:26 — libs/agno/agno/reasoning/azure_ai_foundry.py:26-50 | libs/agno/agno/reasoning/azure_ai_foundry.py:60-83 | libs/agno/agno/reasoning/groq.py:33-56 | libs/agno/agno/reasoning/groq.py:71-94 | libs/agno/agno/reasoning/ollama.py:83-107 | libs/agno/agno/reasoning/ollama.py:117-140 | libs/agno/agno/reasoning/openai.py:55-79 | libs/agno/agno/reasoning/openai.py:94-117 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23–25 lines × 7) · ×1
  • Duplicated block (23–25 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:1077 — libs/agno/agno/db/mysql/async_mysql.py:1077-1101 | libs/agno/agno/db/mysql/mysql.py:1071-1095 | libs/agno/agno/db/postgres/async_postgres.py:1663-1686 | libs/agno/agno/db/postgres/postgres.py:1895-1918 | libs/agno/agno/db/singlestore/singlestore.py:1127-1151 | REDACTED:1593-1615 | REDACTED:1851-1873 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1077` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (24–25 lines × 4) · ×1
  • Duplicated block (24–25 lines × 4) libs/agno/agno/db/mysql/mysql.py:1632 — libs/agno/agno/db/mysql/mysql.py:1632-1655 | libs/agno/agno/db/postgres/postgres.py:2505-2529 | libs/agno/agno/db/singlestore/singlestore.py:1671-1694 | REDACTED:2428-2451 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25 lines × 4) · ×1
  • Duplicated block (25 lines × 4) libs/agno/agno/db/mysql/mysql.py:1731 — libs/agno/agno/db/mysql/mysql.py:1731-1755 | libs/agno/agno/db/postgres/postgres.py:2603-2627 | libs/agno/agno/db/singlestore/singlestore.py:1768-1792 | REDACTED:2525-2549 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (24–25 lines × 3) · ×1
  • Duplicated block (24–25 lines × 3) cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py:148 — cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py:148-171 | cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py:144-168 | cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py:200-223 — before extracting anything, compare `cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_class.py` and `cookbook/04_workflows/01_basic_workflows/02_step_with_function/step_with_function.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 112 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:3164 — libs/agno/agno/db/mysql/async_mysql.py:3164-3188 | libs/agno/agno/db/mysql/mysql.py:3128-3152 | libs/agno/agno/db/singlestore/singlestore.py:3074-3098 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:3164` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/singlestore/singlestore.py:3100` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:3156` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22–25 lines × 3) · ×1
  • Duplicated block (22–25 lines × 3) libs/agno/agno/media/media.py:325 — libs/agno/agno/media/media.py:325-346 | libs/agno/agno/media/media.py:499-521 | libs/agno/agno/media/media.py:663-687 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (17–25 lines × 3) · ×1
  • Duplicated block (17–25 lines × 3) libs/agno/agno/models/anthropic/claude.py:753 — libs/agno/agno/models/anthropic/claude.py:753-769 | libs/agno/agno/models/anthropic/claude.py:864-881 | libs/agno/agno/models/anthropic/claude.py:915-939 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (21–25 lines × 3) · ×1
  • Duplicated block (21–25 lines × 3) libs/agno/agno/team/_run.py:505 — libs/agno/agno/team/_run.py:505-528 | libs/agno/agno/team/_run.py:1349-1373 | libs/agno/agno/team/_run.py:8295-8315 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:505` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:497` calls `raise_if_cancelled`, `generate_team_followups` and `libs/agno/agno/team/_run.py:8292` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–25 lines × 2) · ×1
  • Duplicated block (19–25 lines × 2) libs/agno/agno/db/gcs_json/gcs_json_db.py:375 — libs/agno/agno/db/gcs_json/gcs_json_db.py:375-393 | libs/agno/agno/db/json/json_db.py:414-438 — before extracting anything, compare `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/json/json_db.py` as WHOLE FILES: this scan already matched 70 separate duplicated blocks between them, totalling at least 1566 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–25 lines × 2) · ×1
  • Duplicated block (20–25 lines × 2) libs/agno/agno/os/middleware/jwt.py:897 — libs/agno/agno/os/middleware/jwt.py:897-921 | libs/agno/agno/os/middleware/jwt.py:965-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) REDACTED:401 — REDACTED:401-425 | REDACTED:515-536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24 lines × 12) · ×1
  • Duplicated block (24 lines × 12) libs/agno/agno/utils/print_response/agent.py:526 — libs/agno/agno/utils/print_response/agent.py:526-549 | libs/agno/agno/utils/print_response/agent.py:912-935 | libs/agno/agno/utils/print_response/team.py:235-258 | libs/agno/agno/utils/print_response/team.py:311-334 | libs/agno/agno/utils/print_response/team.py:694-717 | libs/agno/agno/utils/print_response/team.py:852-875 | libs/agno/agno/utils/print_response/team.py:928-951 | libs/agno/agno/utils/print_response/team.py:1170-1193 | libs/agno/agno/utils/print_response/team.py:1244-1267 | libs/agno/agno/utils/print_response/team.py:1626-1649 | libs/agno/agno/utils/print_response/team.py:1801-1824 | libs/agno/agno/utils/print_response/team.py:1877-1900 — before extracting anything, compare `libs/agno/agno/utils/print_response/agent.py` and `libs/agno/agno/utils/print_response/team.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/utils/print_response/team.py:718` calls `update`, `Group` and `libs/agno/agno/utils/print_response/team.py:336` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (24 lines × 9) · ×1
  • Duplicated block (24 lines × 9) libs/agno/agno/db/mysql/async_mysql.py:1383 — libs/agno/agno/db/mysql/async_mysql.py:1383-1406 | libs/agno/agno/db/mysql/async_mysql.py:1434-1457 | libs/agno/agno/db/mysql/async_mysql.py:1485-1508 | libs/agno/agno/db/mysql/mysql.py:1367-1390 | libs/agno/agno/db/mysql/mysql.py:1417-1440 | libs/agno/agno/db/mysql/mysql.py:1467-1490 | libs/agno/agno/db/singlestore/singlestore.py:1418-1441 | libs/agno/agno/db/singlestore/singlestore.py:1468-1491 | libs/agno/agno/db/singlestore/singlestore.py:1518-1541 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1383` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–24 lines × 8) · ×1
  • Duplicated block (23–24 lines × 8) libs/agno/agno/agent/_hooks.py:85 — libs/agno/agno/agent/_hooks.py:85-108 | libs/agno/agno/agent/_hooks.py:195-218 | libs/agno/agno/agent/_hooks.py:300-323 | libs/agno/agno/agent/_hooks.py:404-427 | libs/agno/agno/team/_hooks.py:281-303 | libs/agno/agno/team/_hooks.py:381-403 | libs/agno/agno/team/_hooks.py:480-502 | libs/agno/agno/team/_hooks.py:578-600 — `libs/agno/agno/agent/_hooks.py` and `libs/agno/agno/team/_hooks.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 106 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_hooks.py:85` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–24 lines × 5) · ×1
  • Duplicated block (22–24 lines × 5) libs/agno/agno/workflow/workflow.py:3621 — libs/agno/agno/workflow/workflow.py:3621-3644 | libs/agno/agno/workflow/workflow.py:7954-7977 | libs/agno/agno/workflow/workflow.py:8452-8473 | libs/agno/agno/workflow/workflow.py:9713-9736 | libs/agno/agno/workflow/workflow.py:10212-10233 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14–24 lines × 4) · ×1
  • Duplicated block (14–24 lines × 4) cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:25 — cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:25-47 | cookbook/02_agents/10_human_in_the_loop/confirmation_required.py:25-47 | cookbook/91_tools/python_function_as_tool.py:19-42 | cookbook/91_tools/tool_calls_accesing_agent.py:22-35 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `num_stories` to `int` in one and `int = 10` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (21–24 lines × 4) · ×1
  • Duplicated block (21–24 lines × 4) libs/agno/agno/db/mysql/mysql.py:1564 — libs/agno/agno/db/mysql/mysql.py:1564-1584 | libs/agno/agno/db/postgres/postgres.py:2418-2441 | libs/agno/agno/db/singlestore/singlestore.py:1609-1629 | REDACTED:2358-2378 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:2443` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:1586` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22–24 lines × 4) · ×1
  • Duplicated block (22–24 lines × 4) libs/agno/agno/team/_default_tools.py:577 — libs/agno/agno/team/_default_tools.py:577-600 | libs/agno/agno/team/_default_tools.py:654-677 | libs/agno/agno/team/_task_tools.py:380-401 | libs/agno/agno/team/_task_tools.py:447-468 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (23–24 lines × 3) · ×1
  • Duplicated block (23–24 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1651 — libs/agno/agno/db/mysql/async_mysql.py:1651-1673 | libs/agno/agno/db/postgres/async_postgres.py:2049-2072 | REDACTED:2171-2194 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–24 lines × 2) · ×1
  • Duplicated block (18–24 lines × 2) cookbook/03_teams/15_distributed_rag/01_distributed_rag_pgvector.py:145 — cookbook/03_teams/15_distributed_rag/01_distributed_rag_pgvector.py:145-162 | cookbook/03_teams/15_distributed_rag/01_distributed_rag_pgvector.py:166-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–24 lines × 2) · ×1
  • Duplicated block (19–24 lines × 2) libs/agno/agno/db/firestore/firestore.py:557 — libs/agno/agno/db/firestore/firestore.py:557-575 | libs/agno/agno/db/firestore/firestore.py:686-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23 lines × 7) · ×1
  • Duplicated block (23 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:3069 — libs/agno/agno/db/mysql/async_mysql.py:3069-3091 | libs/agno/agno/db/mysql/mysql.py:3035-3057 | libs/agno/agno/db/postgres/async_postgres.py:3449-3471 | libs/agno/agno/db/postgres/postgres.py:3993-4015 | libs/agno/agno/db/singlestore/singlestore.py:2975-2997 | REDACTED:3596-3618 | REDACTED:3796-3818 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22–23 lines × 5) · ×1
  • Duplicated block (22–23 lines × 5) libs/agno/agno/tools/visualization.py:144 — libs/agno/agno/tools/visualization.py:144-165 | libs/agno/agno/tools/visualization.py:217-238 | libs/agno/agno/tools/visualization.py:282-303 | libs/agno/agno/tools/visualization.py:371-392 | libs/agno/agno/tools/visualization.py:445-467 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/tools/visualization.py:213` calls `grid` and `libs/agno/agno/tools/visualization.py:140` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–23 lines × 4) · ×1
  • Duplicated block (19–23 lines × 4) libs/agno/agno/tools/google/slides.py:605 — libs/agno/agno/tools/google/slides.py:605-627 | libs/agno/agno/tools/google/slides.py:734-752 | libs/agno/agno/tools/google/slides.py:984-1006 | libs/agno/agno/tools/google/slides.py:1039-1061 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/tools/google/slides.py:631` calls `_generate_id` and `libs/agno/agno/tools/google/slides.py:1010` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (21–23 lines × 3) · ×1
  • Duplicated block (21–23 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1579 — libs/agno/agno/db/mysql/async_mysql.py:1579-1600 | libs/agno/agno/db/postgres/async_postgres.py:1960-1982 | REDACTED:2101-2121 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:1602` calls `log_debug` and `REDACTED:2123` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–23 lines × 3) · ×1
  • Duplicated block (19–23 lines × 3) libs/agno/agno/learn/schemas.py:119 — libs/agno/agno/learn/schemas.py:119-141 | libs/agno/agno/learn/schemas.py:217-239 | libs/agno/agno/learn/schemas.py:384-402 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–22 lines × 11) · ×1
  • Duplicated block (20–22 lines × 11) libs/agno/agno/db/dynamo/dynamo.py:1676 — libs/agno/agno/db/dynamo/dynamo.py:1676-1697 | libs/agno/agno/db/firestore/firestore.py:1663-1682 | libs/agno/agno/db/mongo/async_mongo.py:1985-2004 | libs/agno/agno/db/mongo/mongo.py:1790-1809 | libs/agno/agno/db/mysql/async_mysql.py:2194-2213 | libs/agno/agno/db/mysql/mysql.py:2163-2182 | libs/agno/agno/db/postgres/async_postgres.py:2529-2548 | libs/agno/agno/db/postgres/postgres.py:3058-3077 | libs/agno/agno/db/singlestore/singlestore.py:2188-2207 | REDACTED:2723-2742 | REDACTED:2975-2994 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 11 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 11 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/dynamo/dynamo.py:1676` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/firestore/firestore.py:1685` calls `log_debug` and `libs/agno/agno/db/mongo/mongo.py:1812` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–22 lines × 5) · ×1
  • Duplicated block (17–22 lines × 5) libs/agno/agno/db/gcs_json/gcs_json_db.py:1505 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1505-1521 | libs/agno/agno/db/in_memory/in_memory_db.py:1322-1338 | libs/agno/agno/db/json/json_db.py:1605-1621 | libs/agno/agno/db/redis/redis.py:1863-1883 | libs/agno/agno/db/valkey/valkey.py:2296-2317 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22 lines × 5) · ×1
  • Duplicated block (22 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:1383 — libs/agno/agno/db/mysql/async_mysql.py:1383-1404 | libs/agno/agno/db/mysql/mysql.py:1367-1388 | libs/agno/agno/db/singlestore/singlestore.py:1418-1439 | REDACTED:1872-1893 | REDACTED:2129-2150 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19–22 lines × 4) · ×1
  • Duplicated block (19–22 lines × 4) libs/agno/agno/team/_run.py:297 — libs/agno/agno/team/_run.py:297-315 | libs/agno/agno/team/_run.py:647-665 | libs/agno/agno/team/_run.py:1183-1204 | libs/agno/agno/team/_run.py:1546-1567 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–22 lines × 4) · ×1
  • Duplicated block (18–22 lines × 4) libs/agno/agno/workflow/workflow.py:3079 — libs/agno/agno/workflow/workflow.py:3079-3096 | libs/agno/agno/workflow/workflow.py:4086-4103 | libs/agno/agno/workflow/workflow.py:7375-7396 | libs/agno/agno/workflow/workflow.py:9422-9442 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3079` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20–22 lines × 3) · ×1
  • Duplicated block (20–22 lines × 3) libs/agno/agno/db/dynamo/dynamo.py:482 — libs/agno/agno/db/dynamo/dynamo.py:482-501 | libs/agno/agno/db/gcs_json/gcs_json_db.py:340-361 | libs/agno/agno/db/json/json_db.py:379-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (11–22 lines × 3) · ×1
  • Duplicated block (11–22 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:717 — libs/agno/agno/db/mysql/async_mysql.py:717-727 | libs/agno/agno/db/postgres/async_postgres.py:919-940 | REDACTED:876-897 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:898` calls `isinstance`, `get`, `loads` and `libs/agno/agno/db/mysql/async_mysql.py:728` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–22 lines × 3) · ×1
  • Duplicated block (13–22 lines × 3) libs/agno/agno/os/utils.py:2969 — libs/agno/agno/os/utils.py:2969-2990 | libs/agno/agno/os/utils.py:3064-3076 | libs/agno/agno/os/utils.py:3145-3157 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (18–22 lines × 3) · ×1
  • Duplicated block (18–22 lines × 3) libs/agno/agno/workflow/condition.py:248 — libs/agno/agno/workflow/condition.py:248-269 | libs/agno/agno/workflow/loop.py:253-270 | libs/agno/agno/workflow/router.py:292-312 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:248` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/condition.py:272` calls `ValueError` and `libs/agno/agno/workflow/loop.py:272` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–22 lines × 2) · ×1
  • Duplicated block (12–22 lines × 2) libs/agno/agno/db/sql/authz.py:32 — libs/agno/agno/db/sql/authz.py:32-53 | libs/agno/agno/db/sql/authz.py:547-558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) libs/agno_infra/agno/aws/app/fastapi/fastapi.py:41 — libs/agno_infra/agno/aws/app/fastapi/fastapi.py:41-62 | libs/agno_infra/agno/docker/app/fastapi/fastapi.py:37-56 — before extracting anything, compare `libs/agno_infra/agno/aws/app/fastapi/fastapi.py` and `libs/agno_infra/agno/docker/app/fastapi/fastapi.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/aws/app/fastapi/fastapi.py:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (21 lines × 10) · ×1
  • Duplicated block (21 lines × 10) REDACTED:480 — REDACTED:480-500 | REDACTED:686-706 | REDACTED:420-440 | REDACTED:1098-1118 | REDACTED:1212-1232 | REDACTED:1169-1189 | REDACTED:1248-1268 | REDACTED:390-410 | REDACTED:665-685 | REDACTED:397-417 — there are 10 copies across 7 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (21 lines × 8) · ×1
  • Duplicated block (21 lines × 8) libs/agno/agno/workflow/condition.py:817 — libs/agno/agno/workflow/condition.py:817-837 | libs/agno/agno/workflow/condition.py:1271-1291 | libs/agno/agno/workflow/loop.py:672-692 | libs/agno/agno/workflow/loop.py:1069-1089 | libs/agno/agno/workflow/router.py:846-866 | libs/agno/agno/workflow/router.py:1187-1207 | libs/agno/agno/workflow/steps.py:448-468 | libs/agno/agno/workflow/steps.py:753-773 — there are 8 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:817` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/condition.py:839` calls `getattr`, `log_debug` and `libs/agno/agno/workflow/steps.py:471` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–21 lines × 5) · ×1
  • Duplicated block (19–21 lines × 5) libs/agno/agno/db/gcs_json/gcs_json_db.py:1121 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1121-1139 | libs/agno/agno/db/in_memory/in_memory_db.py:960-978 | libs/agno/agno/db/json/json_db.py:1188-1206 | libs/agno/agno/db/redis/redis.py:1471-1489 | libs/agno/agno/db/valkey/valkey.py:1844-1864 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/redis/redis.py:1471` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21 lines × 5) · ×1
  • Duplicated block (21 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:1257 — libs/agno/agno/db/mysql/async_mysql.py:1257-1277 | libs/agno/agno/db/mysql/mysql.py:1247-1267 | libs/agno/agno/db/postgres/async_postgres.py:1870-1890 | libs/agno/agno/db/postgres/postgres.py:2101-2121 | libs/agno/agno/db/singlestore/singlestore.py:1305-1325 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1257` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–21 lines × 4) · ×1
  • Duplicated block (18–21 lines × 4) libs/agno/agno/agent/_run.py:442 — libs/agno/agno/agent/_run.py:442-459 | libs/agno/agno/agent/_run.py:850-867 | libs/agno/agno/agent/_run.py:1589-1606 | libs/agno/agno/agent/_run.py:2202-2222 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:2202` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–21 lines × 4) · ×1
  • Duplicated block (20–21 lines × 4) libs/agno/agno/agent/_run.py:1146 — libs/agno/agno/agent/_run.py:1146-1165 | libs/agno/agno/agent/_run.py:2500-2519 | libs/agno/agno/agent/_run.py:4038-4058 | libs/agno/agno/agent/_run.py:5616-5635 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_run.py:1146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–21 lines × 3) · ×1
  • Duplicated block (12–21 lines × 3) cookbook/91_tools/other/human_in_the_loop.py:54 — cookbook/91_tools/other/human_in_the_loop.py:54-74 | cookbook/91_tools/tool_decorator/tool_decorator.py:25-36 | cookbook/91_tools/tool_hooks/pre_and_post_hooks.py:38-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (11–21 lines × 3) · ×1
  • Duplicated block (11–21 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:830 — libs/agno/agno/db/mysql/async_mysql.py:830-840 | libs/agno/agno/db/postgres/async_postgres.py:1166-1186 | REDACTED:1132-1152 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:1187` calls `is_foreign_key_violation`, `log_warning` and `libs/agno/agno/db/mysql/async_mysql.py:841` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20 lines × 7) · ×1
  • Duplicated block (20 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:1244 — libs/agno/agno/db/mysql/async_mysql.py:1244-1263 | libs/agno/agno/db/mysql/mysql.py:1234-1253 | libs/agno/agno/db/postgres/async_postgres.py:1857-1876 | libs/agno/agno/db/postgres/postgres.py:2088-2107 | libs/agno/agno/db/singlestore/singlestore.py:1292-1311 | REDACTED:1737-1756 | REDACTED:1994-2013 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20 lines × 6) · ×1
  • Duplicated block (20 lines × 6) libs/agno/agno/reasoning/azure_ai_foundry.py:109 — libs/agno/agno/reasoning/azure_ai_foundry.py:109-128 | libs/agno/agno/reasoning/azure_ai_foundry.py:155-174 | libs/agno/agno/reasoning/groq.py:125-144 | libs/agno/agno/reasoning/groq.py:176-195 | libs/agno/agno/reasoning/ollama.py:166-185 | libs/agno/agno/reasoning/ollama.py:212-231 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/groq.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 131 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–20 lines × 6) · ×1
  • Duplicated block (19–20 lines × 6) libs/agno_infra/agno/cli/operator.py:118 — libs/agno_infra/agno/cli/operator.py:118-136 | libs/agno_infra/agno/cli/operator.py:191-209 | libs/agno_infra/agno/cli/operator.py:263-281 | libs/agno_infra/agno/infra/operator.py:267-286 | libs/agno_infra/agno/infra/operator.py:338-357 | libs/agno_infra/agno/infra/operator.py:411-430 — `libs/agno_infra/agno/cli/operator.py` and `libs/agno_infra/agno/infra/operator.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 123 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/cli/operator.py:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–20 lines × 4) · ×1
  • Duplicated block (15–20 lines × 4) libs/agno/agno/team/_run.py:4650 — libs/agno/agno/team/_run.py:4650-4669 | libs/agno/agno/team/_run.py:4733-4752 | libs/agno/agno/team/_run.py:4881-4895 | libs/agno/agno/team/_run.py:4941-4955 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:4648` calls `isolate_media_scrub_targets` and `libs/agno/agno/team/_run.py:4880` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–20 lines × 3) · ×1
  • Duplicated block (16–20 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:225 — libs/agno/agno/db/mysql/async_mysql.py:225-240 | libs/agno/agno/db/mysql/mysql.py:220-235 | libs/agno/agno/db/singlestore/singlestore.py:287-306 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–20 lines × 3) · ×1
  • Duplicated block (17–20 lines × 3) libs/agno/agno/models/aws/claude.py:208 — libs/agno/agno/models/aws/claude.py:208-227 | libs/agno/agno/models/azure/claude.py:139-155 | libs/agno/agno/models/vertexai/claude.py:131-150 — `libs/agno/agno/models/aws/claude.py` and `libs/agno/agno/models/azure/claude.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 64 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–20 lines × 2) · ×1
  • Duplicated block (15–20 lines × 2) REDACTED:3503 — REDACTED:3503-3522 | REDACTED:3583-3597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `db` to `BaseDb` in one and `AsyncBaseDb` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) REDACTED:86 — REDACTED:86-101 | REDACTED:101-120 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (17–19 lines × 16) · ×1
  • Duplicated block (17–19 lines × 16) libs/agno/agno/db/dynamo/dynamo.py:1645 — libs/agno/agno/db/dynamo/dynamo.py:1645-1663 | libs/agno/agno/db/firestore/firestore.py:1640-1656 | libs/agno/agno/db/gcs_json/gcs_json_db.py:1102-1118 | libs/agno/agno/db/in_memory/in_memory_db.py:941-957 | libs/agno/agno/db/json/json_db.py:1169-1185 | libs/agno/agno/db/mongo/async_mongo.py:1962-1978 | libs/agno/agno/db/mongo/mongo.py:1767-1783 | libs/agno/agno/db/mysql/async_mysql.py:2170-2186 | libs/agno/agno/db/mysql/mysql.py:2140-2156 | libs/agno/agno/db/postgres/async_postgres.py:2505-2521 | libs/agno/agno/db/postgres/postgres.py:3034-3050 | libs/agno/agno/db/redis/redis.py:1451-1467 | libs/agno/agno/db/singlestore/singlestore.py:2165-2181 | REDACTED:2698-2714 | REDACTED:2950-2966 | libs/agno/agno/db/valkey/valkey.py:1824-1840 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 16 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 16 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18–19 lines × 8) · ×1
  • Duplicated block (18–19 lines × 8) libs/agno/agno/workflow/workflow.py:3126 — libs/agno/agno/workflow/workflow.py:3126-3143 | libs/agno/agno/workflow/workflow.py:3654-3672 | libs/agno/agno/workflow/workflow.py:4131-4148 | libs/agno/agno/workflow/workflow.py:4699-4717 | libs/agno/agno/workflow/workflow.py:7424-7441 | libs/agno/agno/workflow/workflow.py:8483-8501 | libs/agno/agno/workflow/workflow.py:9470-9487 | libs/agno/agno/workflow/workflow.py:10243-10261 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3654` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 6) · ×1
  • Duplicated block (18–19 lines × 6) libs/agno/agno/team/_default_tools.py:787 — libs/agno/agno/team/_default_tools.py:787-805 | libs/agno/agno/team/_default_tools.py:973-991 | libs/agno/agno/team/_task_tools.py:582-599 | libs/agno/agno/team/_task_tools.py:765-782 | libs/agno/agno/team/_task_tools.py:918-935 | libs/agno/agno/team/_task_tools.py:1123-1140 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_default_tools.py:787` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 4) · ×1
  • Duplicated block (19 lines × 4) libs/agno/agno/workflow/workflow.py:3471 — libs/agno/agno/workflow/workflow.py:3471-3489 | libs/agno/agno/workflow/workflow.py:4512-4530 | libs/agno/agno/workflow/workflow.py:8316-8334 | libs/agno/agno/workflow/workflow.py:10076-10094 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (11–19 lines × 2) · ×1
  • Duplicated block (11–19 lines × 2) libs/agno/agno/db/postgres/postgres.py:1164 — libs/agno/agno/db/postgres/postgres.py:1164-1182 | libs/agno/agno/db/postgres/postgres.py:7675-7685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18 lines × 10) · ×1
  • Duplicated block (18 lines × 10) libs/agno/agno/reasoning/anthropic.py:126 — libs/agno/agno/reasoning/anthropic.py:126-143 | libs/agno/agno/reasoning/anthropic.py:205-222 | libs/agno/agno/reasoning/deepseek.py:89-106 | libs/agno/agno/reasoning/deepseek.py:168-185 | libs/agno/agno/reasoning/gemini.py:135-152 | libs/agno/agno/reasoning/gemini.py:175-192 | libs/agno/agno/reasoning/moonshot.py:161-178 | libs/agno/agno/reasoning/moonshot.py:206-223 | libs/agno/agno/reasoning/vertexai.py:117-134 | libs/agno/agno/reasoning/vertexai.py:159-176 — before extracting anything, compare `libs/agno/agno/reasoning/anthropic.py` and `libs/agno/agno/reasoning/deepseek.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/reasoning/anthropic.py:126` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–18 lines × 8) · ×1
  • Duplicated block (17–18 lines × 8) libs/agno/agno/workflow/workflow.py:3621 — libs/agno/agno/workflow/workflow.py:3621-3638 | libs/agno/agno/workflow/workflow.py:3664-3680 | libs/agno/agno/workflow/workflow.py:7954-7971 | libs/agno/agno/workflow/workflow.py:8452-8468 | libs/agno/agno/workflow/workflow.py:8493-8509 | libs/agno/agno/workflow/workflow.py:9713-9730 | libs/agno/agno/workflow/workflow.py:10212-10228 | libs/agno/agno/workflow/workflow.py:10253-10269 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3621` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (18 lines × 7) · ×1
  • Duplicated block (18 lines × 7) libs/agno/agno/os/routers/agents/router.py:1295 — libs/agno/agno/os/routers/agents/router.py:1295-1312 | libs/agno/agno/os/routers/agents/router.py:1871-1888 | libs/agno/agno/os/routers/agents/router.py:1987-2004 | libs/agno/agno/os/routers/agents/router.py:2246-2263 | libs/agno/agno/os/routers/agents/router.py:2344-2361 | libs/agno/agno/os/routers/agents/router.py:2409-2426 | libs/agno/agno/os/routers/agents/router.py:2596-2613 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (17–18 lines × 7) · ×1
  • Duplicated block (17–18 lines × 7) libs/agno/agno/workflow/workflow.py:3620 — libs/agno/agno/workflow/workflow.py:3620-3636 | libs/agno/agno/workflow/workflow.py:7953-7969 | libs/agno/agno/workflow/workflow.py:8209-8226 | libs/agno/agno/workflow/workflow.py:8450-8467 | libs/agno/agno/workflow/workflow.py:9712-9728 | libs/agno/agno/workflow/workflow.py:9969-9986 | libs/agno/agno/workflow/workflow.py:10210-10227 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3620` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:3637` calls `getattr` and `libs/agno/agno/workflow/workflow.py:8227` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18 lines × 6) · ×1
  • Duplicated block (18 lines × 6) libs/agno/agno/os/routers/teams/router.py:1188 — libs/agno/agno/os/routers/teams/router.py:1188-1205 | libs/agno/agno/os/routers/teams/router.py:1806-1823 | libs/agno/agno/os/routers/teams/router.py:2132-2149 | libs/agno/agno/os/routers/teams/router.py:2227-2244 | libs/agno/agno/os/routers/teams/router.py:2292-2309 | libs/agno/agno/os/routers/teams/router.py:2357-2374 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 5) · ×1
  • Duplicated block (15–18 lines × 5) libs/agno/agno/db/firestore/firestore.py:1395 — libs/agno/agno/db/firestore/firestore.py:1395-1410 | libs/agno/agno/db/gcs_json/gcs_json_db.py:982-996 | libs/agno/agno/db/in_memory/in_memory_db.py:823-837 | libs/agno/agno/db/json/json_db.py:1049-1063 | libs/agno/agno/db/redis/redis.py:1233-1250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (18 lines × 5) · ×1
  • Duplicated block (18 lines × 5) libs/agno_infra/agno/aws/resources.py:169 — libs/agno_infra/agno/aws/resources.py:169-186 | libs/agno_infra/agno/aws/resources.py:324-341 | libs/agno_infra/agno/aws/resources.py:472-489 | libs/agno_infra/agno/docker/resources.py:291-308 | libs/agno_infra/agno/docker/resources.py:447-464 — `libs/agno_infra/agno/aws/resources.py` and `libs/agno_infra/agno/docker/resources.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 145 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno_infra/agno/aws/resources.py:187` calls `get_aws_region`, `print_info`, `get_aws_profile` and `libs/agno_infra/agno/docker/resources.py:309` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–18 lines × 4) · ×1
  • Duplicated block (15–18 lines × 4) libs/agno/agno/models/azure/openai_chat.py:152 — libs/agno/agno/models/azure/openai_chat.py:152-169 | libs/agno/agno/models/cerebras/cerebras.py:152-166 | libs/agno/agno/models/groq/groq.py:121-135 | libs/agno/agno/models/meta/llama.py:120-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16–18 lines × 4) · ×1
  • Duplicated block (16–18 lines × 4) libs/agno/agno/workflow/workflow.py:3601 — libs/agno/agno/workflow/workflow.py:3601-3618 | libs/agno/agno/workflow/workflow.py:4646-4663 | libs/agno/agno/workflow/workflow.py:8433-8448 | libs/agno/agno/workflow/workflow.py:10193-10208 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:8433` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–18 lines × 3) · ×1
  • Duplicated block (12–18 lines × 3) cookbook/frameworks/claude-agent-sdk/continue_from/05_agentos_api.py:83 — cookbook/frameworks/claude-agent-sdk/continue_from/05_agentos_api.py:83-100 | cookbook/frameworks/claude-agent-sdk/metrics_agentos.py:53-65 | cookbook/frameworks/codex/codex_metrics_agentos.py:54-65 — `cookbook/frameworks/claude-agent-sdk/metrics_agentos.py` and `cookbook/frameworks/codex/codex_metrics_agentos.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 65 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–18 lines × 3) · ×1
  • Duplicated block (13–18 lines × 3) libs/agno/agno/db/mysql/mysql.py:707 — libs/agno/agno/db/mysql/mysql.py:707-722 | libs/agno/agno/db/postgres/postgres.py:1084-1101 | libs/agno/agno/db/singlestore/singlestore.py:769-781 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–18 lines × 3) · ×1
  • Duplicated block (11–18 lines × 3) libs/agno/agno/os/routers/session/session.py:510 — libs/agno/agno/os/routers/session/session.py:510-520 | libs/agno/agno/os/routers/session/session.py:743-753 | libs/agno/agno/os/routers/session/session.py:783-800 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/session/session.py:510` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–18 lines × 3) · ×1
  • Duplicated block (16–18 lines × 3) libs/agno/agno/team/_run.py:1040 — libs/agno/agno/team/_run.py:1040-1055 | libs/agno/agno/team/_run.py:1843-1860 | libs/agno/agno/team/_run.py:8600-8617 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (17 lines × 18) · ×1
  • Duplicated block (17 lines × 18) libs/agno/agno/reasoning/manager.py:404 — libs/agno/agno/reasoning/manager.py:404-420 | libs/agno/agno/reasoning/manager.py:428-444 | libs/agno/agno/reasoning/manager.py:452-468 | libs/agno/agno/reasoning/manager.py:476-492 | libs/agno/agno/reasoning/manager.py:500-516 | libs/agno/agno/reasoning/manager.py:524-540 | libs/agno/agno/reasoning/manager.py:548-564 | libs/agno/agno/reasoning/manager.py:572-588 | libs/agno/agno/reasoning/manager.py:596-612 | libs/agno/agno/reasoning/manager.py:644-660 | libs/agno/agno/reasoning/manager.py:668-684 | libs/agno/agno/reasoning/manager.py:692-708 | libs/agno/agno/reasoning/manager.py:716-732 | libs/agno/agno/reasoning/manager.py:740-756 | libs/agno/agno/reasoning/manager.py:764-780 | libs/agno/agno/reasoning/manager.py:788-804 | libs/agno/agno/reasoning/manager.py:812-828 | libs/agno/agno/reasoning/manager.py:836-852 — all 18 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (17 lines × 7) · ×1
  • Duplicated block (17 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:3169 — libs/agno/agno/db/mysql/async_mysql.py:3169-3185 | libs/agno/agno/db/mysql/mysql.py:3133-3149 | libs/agno/agno/db/postgres/async_postgres.py:3606-3622 | libs/agno/agno/db/postgres/postgres.py:4148-4164 | libs/agno/agno/db/singlestore/singlestore.py:3079-3095 | REDACTED:3755-3771 | REDACTED:3954-3970 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:3169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/singlestore/singlestore.py:3100` calls `log_debug` and `libs/agno/agno/db/mysql/mysql.py:3156` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–17 lines × 5) · ×1
  • Duplicated block (16–17 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:2062 — libs/agno/agno/db/mysql/async_mysql.py:2062-2077 | libs/agno/agno/db/mysql/mysql.py:2033-2049 | libs/agno/agno/db/singlestore/singlestore.py:2062-2077 | REDACTED:2590-2606 | REDACTED:2845-2861 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 5) · ×1
  • Duplicated block (17 lines × 5) REDACTED:267 — REDACTED:267-283 | REDACTED:629-645 | REDACTED:806-822 | REDACTED:687-703 | REDACTED:784-800 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (11–17 lines × 4) · ×1
  • Duplicated block (11–17 lines × 4) libs/agno/agno/models/anthropic/claude.py:547 — libs/agno/agno/models/anthropic/claude.py:547-560 | libs/agno/agno/models/aws/claude.py:184-200 | libs/agno/agno/models/azure/claude.py:121-131 | libs/agno/agno/models/vertexai/claude.py:107-123 — `libs/agno/agno/models/aws/claude.py` and `libs/agno/agno/models/azure/claude.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 64 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (13–17 lines × 3) · ×1
  • Duplicated block (13–17 lines × 3) cookbook/02_agents/20_time_travel/01_continue_from.py:82 — cookbook/02_agents/20_time_travel/01_continue_from.py:82-97 | cookbook/02_agents/20_time_travel/02_fork_run.py:73-89 | cookbook/03_teams/25_time_travel/01_continue_from.py:80-92 — before extracting anything, compare `cookbook/02_agents/20_time_travel/01_continue_from.py` and `cookbook/02_agents/20_time_travel/02_fork_run.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/02_agents/20_time_travel/01_continue_from.py:82` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–17 lines × 3) · ×1
  • Duplicated block (14–17 lines × 3) cookbook/05_agent_os/21_factories/01_basic.py:99 — cookbook/05_agent_os/21_factories/01_basic.py:99-113 | cookbook/05_agent_os/21_factories/05_team_factory.py:107-123 | cookbook/05_agent_os/21_factories/06_workflow_factory.py:113-126 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cookbook/05_agent_os/21_factories/01_basic.py:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–17 lines × 2) · ×1
  • Duplicated block (6–17 lines × 2) libs/agno/agno/os/routers/knowledge/knowledge.py:750 — libs/agno/agno/os/routers/knowledge/knowledge.py:750-766 | libs/agno/agno/os/routers/knowledge/knowledge.py:1415-1420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/knowledge/knowledge.py:750` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) libs/agno/agno/team/_task_tools.py:988 — libs/agno/agno/team/_task_tools.py:988-1004 | libs/agno/agno/team/_task_tools.py:1203-1216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_task_tools.py:1203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–17 lines × 2) · ×1
  • Duplicated block (11–17 lines × 2) REDACTED:427 — REDACTED:427-443 | REDACTED:482-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:494` calls `_async_embed_documents`, `retrievable_documents` and `REDACTED:445` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16 lines × 23) · ×1
  • Duplicated block (16 lines × 23) libs/agno/agno/agent/_cli.py:121 — libs/agno/agno/agent/_cli.py:121-136 | libs/agno/agno/agent/_cli.py:221-236 | libs/agno/agno/agent/_run.py:4381-4396 | libs/agno/agno/agent/agent.py:1327-1342 | libs/agno/agno/agent/agent.py:1385-1400 | libs/agno/agno/agent/agent.py:1557-1572 | libs/agno/agno/agent/agent.py:1666-1681 | libs/agno/agno/agent/agent.py:1750-1765 | libs/agno/agno/agent/agent.py:1836-1851 | libs/agno/agno/agent/remote.py:314-329 | libs/agno/agno/agent/remote.py:336-351 | libs/agno/agno/team/_cli.py:140-155 | libs/agno/agno/team/_cli.py:246-261 | libs/agno/agno/team/_run.py:9305-9320 | libs/agno/agno/team/remote.py:307-322 | libs/agno/agno/team/remote.py:329-344 | libs/agno/agno/team/team.py:952-967 | libs/agno/agno/team/team.py:1062-1077 | libs/agno/agno/team/team.py:1151-1166 | libs/agno/agno/team/team.py:1238-1253 | libs/agno/agno/team/team.py:1327-1342 | libs/agno/agno/team/team.py:1387-1402 | libs/agno/agno/workflow/workflow.py:10855-10870 — `libs/agno/agno/agent/_cli.py` and `libs/agno/agno/team/_cli.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 101 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_cli.py:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–16 lines × 8) · ×1
  • Duplicated block (11–16 lines × 8) libs/agno/agno/workflow/workflow.py:3538 — libs/agno/agno/workflow/workflow.py:3538-3553 | libs/agno/agno/workflow/workflow.py:4578-4593 | libs/agno/agno/workflow/workflow.py:8040-8050 | libs/agno/agno/workflow/workflow.py:8144-8156 | libs/agno/agno/workflow/workflow.py:8375-8386 | libs/agno/agno/workflow/workflow.py:9799-9809 | libs/agno/agno/workflow/workflow.py:9904-9916 | libs/agno/agno/workflow/workflow.py:10135-10146 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/workflow.py:3538` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/workflow.py:4596` calls `RunCancelledException` and `libs/agno/agno/workflow/workflow.py:3555` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–16 lines × 6) · ×1
  • Duplicated block (15–16 lines × 6) REDACTED:429 — REDACTED:429-444 | REDACTED:752-767 | REDACTED:358-373 | REDACTED:679-694 | REDACTED:827-841 | REDACTED:1044-1058 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (16 lines × 6) · ×1
  • Duplicated block (16 lines × 6) libs/agno/agno/db/mongo/async_mongo.py:1400 — libs/agno/agno/db/mongo/async_mongo.py:1400-1416 | libs/agno/agno/db/mongo/mongo.py:1210-1226 | libs/agno/agno/db/mysql/async_mysql.py:1528-1543 | libs/agno/agno/db/mysql/mysql.py:1509-1524 | REDACTED:2044-2059 | REDACTED:2301-2316 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mongo/async_mongo.py:1400` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–16 lines × 5) · ×1
  • Duplicated block (14–16 lines × 5) libs/agno/agno/agent/_run.py:1938 — libs/agno/agno/agent/_run.py:1938-1952 | libs/agno/agno/agent/_run.py:2693-2708 | libs/agno/agno/team/_run.py:3028-3041 | libs/agno/agno/team/_run.py:3433-3447 | libs/agno/agno/team/_run.py:4114-4128 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (12–16 lines × 5) · ×1
  • Duplicated block (12–16 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:223 — libs/agno/agno/db/mysql/async_mysql.py:223-234 | libs/agno/agno/db/mysql/mysql.py:218-229 | libs/agno/agno/db/postgres/async_postgres.py:393-404 | libs/agno/agno/db/singlestore/singlestore.py:285-300 | REDACTED:378-389 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14–16 lines × 4) · ×1
  • Duplicated block (14–16 lines × 4) REDACTED:963 — REDACTED:963-976 | REDACTED:1000-1015 | REDACTED:1041-1056 | REDACTED:1080-1095 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–16 lines × 3) · ×1
  • Duplicated block (15–16 lines × 3) libs/agno/agno/agent/_tools.py:912 — libs/agno/agno/agent/_tools.py:912-927 | libs/agno/agno/agent/_tools.py:1027-1042 | libs/agno/agno/team/_response.py:1620-1634 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/agent/_tools.py:912` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `agent` to `"Agent"` in one and `Agent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:1525 — libs/agno/agno/db/mysql/async_mysql.py:1525-1540 | libs/agno/agno/db/mysql/mysql.py:1506-1521 | libs/agno/agno/db/singlestore/singlestore.py:1557-1570 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–16 lines × 3) · ×1
  • Duplicated block (4–16 lines × 3) libs/agno/agno/media/storage/gcs/gcs.py:103 — libs/agno/agno/media/storage/gcs/gcs.py:103-106 | libs/agno/agno/media/storage/s3/async_s3.py:80-95 | libs/agno/agno/media/storage/s3/s3.py:82-97 — before extracting anything, compare `libs/agno/agno/media/storage/s3/async_s3.py` and `libs/agno/agno/media/storage/s3/s3.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–15 lines × 17) · ×1
  • Duplicated block (13–15 lines × 17) REDACTED:254 — REDACTED:254-266 | REDACTED:472-484 | REDACTED:678-690 | REDACTED:412-424 | REDACTED:1090-1102 | REDACTED:1204-1216 | REDACTED:616-628 | REDACTED:793-805 | REDACTED:1161-1173 | REDACTED:1240-1252 | REDACTED:731-743 | REDACTED:382-394 | REDACTED:473-485 | REDACTED:674-686 | REDACTED:771-783 | REDACTED:655-669 | REDACTED:389-401 — there are 17 copies across 12 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 17 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:655` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 15) · ×1
  • Duplicated block (15 lines × 15) libs/agno/agno/db/postgres/async_postgres.py:215 — libs/agno/agno/db/postgres/async_postgres.py:215-229 | libs/agno/agno/db/postgres/postgres.py:255-269 | REDACTED:151-165 | REDACTED:200-214 | libs/agno/agno/os/interfaces/slack/router.py:116-130 | libs/agno/agno/team/team.py:692-706 | libs/agno/agno/team/team.py:1501-1515 | libs/agno/agno/team/team.py:1616-1630 | libs/agno/agno/tools/studio.py:3027-3041 | libs/agno/agno/tools/studio.py:3152-3166 | libs/agno/agno/tools/studio.py:4113-4127 | libs/agno/agno/tools/studio.py:4162-4176 | libs/agno/agno/tools/studio.py:4240-4254 | libs/agno/agno/tools/studio.py:4291-4305 | libs/agnoctl/agnoctl/commands/connect.py:570-584 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–15 lines × 11) · ×1
  • Duplicated block (12–15 lines × 11) libs/agno/agno/team/_run.py:525 — libs/agno/agno/team/_run.py:525-536 | libs/agno/agno/team/_run.py:1024-1035 | libs/agno/agno/team/_run.py:1368-1382 | libs/agno/agno/team/_run.py:1824-1838 | libs/agno/agno/team/_run.py:2425-2436 | libs/agno/agno/team/_run.py:2963-2974 | libs/agno/agno/team/_run.py:3362-3373 | libs/agno/agno/team/_run.py:4029-4040 | libs/agno/agno/team/_run.py:8312-8323 | libs/agno/agno/team/_run.py:8581-8592 | libs/agno/agno/team/_run.py:10426-10437 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/team/_run.py:537` calls `log_error` and `libs/agno/agno/team/_run.py:1839` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15 lines × 10) · ×1
  • Duplicated block (15 lines × 10) libs/agno/agno/workflow/condition.py:817 — libs/agno/agno/workflow/condition.py:817-831 | libs/agno/agno/workflow/condition.py:1271-1285 | libs/agno/agno/workflow/loop.py:672-686 | libs/agno/agno/workflow/loop.py:1069-1083 | libs/agno/agno/workflow/parallel.py:545-559 | libs/agno/agno/workflow/parallel.py:911-925 | libs/agno/agno/workflow/router.py:846-860 | libs/agno/agno/workflow/router.py:1187-1201 | libs/agno/agno/workflow/steps.py:448-462 | libs/agno/agno/workflow/steps.py:753-767 — there are 10 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:817` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/workflow/parallel.py:561` calls `put` and `libs/agno/agno/workflow/condition.py:832` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15 lines × 8) · ×1
  • Duplicated block (15 lines × 8) libs/agno/agno/db/postgres/async_postgres.py:3474 — libs/agno/agno/db/postgres/async_postgres.py:3474-3488 | libs/agno/agno/db/postgres/async_postgres.py:3625-3639 | libs/agno/agno/db/postgres/postgres.py:4018-4032 | libs/agno/agno/db/postgres/postgres.py:4167-4181 | REDACTED:3621-3635 | REDACTED:3774-3788 | REDACTED:3821-3835 | REDACTED:3973-3987 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:3490` calls `log_debug` and `REDACTED:3639` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–15 lines × 4) · ×1
  • Duplicated block (10–15 lines × 4) libs/agno/agno/db/mysql/mysql.py:828 — libs/agno/agno/db/mysql/mysql.py:828-837 | libs/agno/agno/db/postgres/postgres.py:1333-1347 | libs/agno/agno/db/singlestore/singlestore.py:883-892 | REDACTED:1327-1341 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/postgres/postgres.py:1348` calls `is_foreign_key_violation`, `log_warning` and `libs/agno/agno/db/mysql/mysql.py:838` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–15 lines × 3) · ×1
  • Duplicated block (10–15 lines × 3) libs/agno/agno/db/mysql/mysql.py:1758 — libs/agno/agno/db/mysql/mysql.py:1758-1767 | libs/agno/agno/db/postgres/postgres.py:2630-2644 | libs/agno/agno/db/singlestore/singlestore.py:2022-2036 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–15 lines × 3) · ×1
  • Duplicated block (13–15 lines × 3) libs/agno/agno/team/_run.py:991 — libs/agno/agno/team/_run.py:991-1004 | libs/agno/agno/team/_run.py:1789-1803 | libs/agno/agno/team/_run.py:8547-8559 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:8547` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/team/_run.py:1786` calls `generate_team_followups_stream` and `libs/agno/agno/team/_run.py:8547` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–15 lines × 2) · ×1
  • Duplicated block (10–15 lines × 2) libs/agno/agno/db/mysql/utils.py:161 — libs/agno/agno/db/mysql/utils.py:161-175 | libs/agno/agno/db/mysql/utils.py:215-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–15 lines × 2) · ×1
  • Duplicated block (9–15 lines × 2) libs/agno_infra/agno/cli/utils.py:29 — libs/agno_infra/agno/cli/utils.py:29-43 | libs/agno_infra/agno/cli/utils.py:64-72 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/cli/utils.py:29` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14 lines × 13) · ×1
  • Duplicated block (14 lines × 13) REDACTED:253 — REDACTED:253-267 | REDACTED:369-383 | REDACTED:501-515 | REDACTED:567-581 | REDACTED:690-704 | REDACTED:820-834 | REDACTED:217-231 | REDACTED:313-327 | REDACTED:412-426 | REDACTED:550-564 | REDACTED:637-651 | REDACTED:725-739 | REDACTED:3080-3093 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 12) · ×1
  • Duplicated block (14 lines × 12) libs/agno/agno/reasoning/azure_ai_foundry.py:116 — libs/agno/agno/reasoning/azure_ai_foundry.py:116-129 | libs/agno/agno/reasoning/azure_ai_foundry.py:162-175 | libs/agno/agno/reasoning/deepseek.py:95-108 | libs/agno/agno/reasoning/deepseek.py:174-187 | libs/agno/agno/reasoning/gemini.py:141-154 | libs/agno/agno/reasoning/gemini.py:181-194 | libs/agno/agno/reasoning/groq.py:132-145 | libs/agno/agno/reasoning/groq.py:183-196 | libs/agno/agno/reasoning/moonshot.py:167-180 | libs/agno/agno/reasoning/moonshot.py:212-225 | libs/agno/agno/reasoning/ollama.py:173-186 | libs/agno/agno/reasoning/ollama.py:219-232 — before extracting anything, compare `libs/agno/agno/reasoning/azure_ai_foundry.py` and `libs/agno/agno/reasoning/deepseek.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/reasoning/azure_ai_foundry.py:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–14 lines × 7) · ×1
  • Duplicated block (10–14 lines × 7) libs/agno/agno/utils/print_response/team.py:187 — libs/agno/agno/utils/print_response/team.py:187-196 | libs/agno/agno/utils/print_response/team.py:265-278 | libs/agno/agno/utils/print_response/team.py:598-607 | libs/agno/agno/utils/print_response/team.py:794-803 | libs/agno/agno/utils/print_response/team.py:1123-1132 | libs/agno/agno/utils/print_response/team.py:1200-1211 | libs/agno/agno/utils/print_response/team.py:1529-1538 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/utils/print_response/team.py:805` calls `_get_member_name` and `libs/agno/agno/utils/print_response/team.py:198` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–14 lines × 5) · ×1
  • Duplicated block (11–14 lines × 5) REDACTED:789 — REDACTED:789-800 | REDACTED:905-915 | REDACTED:955-965 | REDACTED:1235-1248 | REDACTED:1305-1316 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:789` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×1
  • Duplicated block (14 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:111 — libs/agno/agno/db/mysql/async_mysql.py:111-124 | libs/agno/agno/db/mysql/mysql.py:110-123 | libs/agno/agno/db/postgres/postgres.py:236-249 | libs/agno/agno/db/singlestore/singlestore.py:108-121 | libs/agno/agno/db/valkey/valkey.py:133-146 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 5) · ×1
  • Duplicated block (13–14 lines × 5) libs/agno/agno/team/_run.py:7580 — libs/agno/agno/team/_run.py:7580-7592 | libs/agno/agno/team/_run.py:7823-7836 | libs/agno/agno/team/_run.py:7896-7909 | libs/agno/agno/team/_run.py:8061-8073 | libs/agno/agno/team/_run.py:8113-8125 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_run.py:7580` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–14 lines × 5) · ×1
  • Duplicated block (12–14 lines × 5) libs/agno/agno/workflow/utils/hitl.py:480 — libs/agno/agno/workflow/utils/hitl.py:480-491 | libs/agno/agno/workflow/workflow.py:3179-3192 | libs/agno/agno/workflow/workflow.py:3704-3717 | libs/agno/agno/workflow/workflow.py:4184-4197 | libs/agno/agno/workflow/workflow.py:4749-4762 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–14 lines × 4) · ×1
  • Duplicated block (12–14 lines × 4) libs/agno/agno/os/routers/schedules/router.py:296 — libs/agno/agno/os/routers/schedules/router.py:296-309 | libs/agno/agno/os/routers/schedules/router.py:404-415 | libs/agno/agno/os/routers/schedules/router.py:427-439 | libs/agno/agno/os/routers/schedules/router.py:502-514 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8–14 lines × 3) · ×1
  • Duplicated block (8–14 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:845 — libs/agno/agno/db/mysql/async_mysql.py:845-852 | libs/agno/agno/db/postgres/async_postgres.py:1196-1209 | REDACTED:1157-1170 — `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/postgres/async_postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1830 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–14 lines × 3) · ×1
  • Duplicated block (11–14 lines × 3) libs/agno/agno/db/postgres/postgres.py:5172 — libs/agno/agno/db/postgres/postgres.py:5172-5182 | libs/agno/agno/db/postgres/postgres.py:5536-5549 | REDACTED:5012-5022 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/postgres.py:5172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5–14 lines × 3) · ×1
  • Duplicated block (5–14 lines × 3) libs/agno/agno/os/interfaces/a2a/utils.py:604 — libs/agno/agno/os/interfaces/a2a/utils.py:604-617 | libs/agno/agno/os/interfaces/a2a/utils.py:621-634 | libs/agno/agno/os/interfaces/a2a/utils.py:638-642 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/interfaces/a2a/utils.py:638` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) libs/agno/agno/team/_task_tools.py:974 — libs/agno/agno/team/_task_tools.py:974-987 | libs/agno/agno/team/_task_tools.py:1191-1201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/team/_task_tools.py:1191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 16) · ×1
  • Duplicated block (13 lines × 16) REDACTED:251 — REDACTED:251-265 | REDACTED:367-381 | REDACTED:499-513 | REDACTED:566-579 | REDACTED:689-702 | REDACTED:819-832 | REDACTED:215-229 | REDACTED:311-325 | REDACTED:410-424 | REDACTED:549-562 | REDACTED:636-649 | REDACTED:724-737 | REDACTED:765-777 | REDACTED:994-1006 | REDACTED:3079-3091 | REDACTED:4056-4068 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3075` calls `_user_id_column_ddl` and `REDACTED:249` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 8) · ×1
  • Duplicated block (13 lines × 8) libs/agno/agno/team/_run.py:2699 — libs/agno/agno/team/_run.py:2699-2711 | libs/agno/agno/team/_run.py:2714-2726 | libs/agno/agno/team/_run.py:3830-3842 | libs/agno/agno/team/_run.py:3845-3857 | libs/agno/agno/team/_run.py:10137-10149 | libs/agno/agno/team/_run.py:10154-10166 | libs/agno/agno/team/_run.py:10257-10269 | libs/agno/agno/team/_run.py:10274-10286 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–13 lines × 6) · ×1
  • Duplicated block (9–13 lines × 6) libs/agno/agno/os/routers/agents/router.py:950 — libs/agno/agno/os/routers/agents/router.py:950-958 | libs/agno/agno/os/routers/agents/router.py:1073-1085 | libs/agno/agno/os/routers/teams/router.py:857-865 | libs/agno/agno/os/routers/teams/router.py:976-988 | libs/agno/agno/os/routers/workflows/router.py:1965-1973 | libs/agno/agno/os/routers/workflows/router.py:2075-2087 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:950` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 6) · ×1
  • Duplicated block (12–13 lines × 6) libs/agno_infra/agno/aws/resources.py:174 — libs/agno_infra/agno/aws/resources.py:174-185 | libs/agno_infra/agno/aws/resources.py:329-340 | libs/agno_infra/agno/aws/resources.py:477-488 | libs/agno_infra/agno/docker/resources.py:131-143 | libs/agno_infra/agno/docker/resources.py:296-307 | libs/agno_infra/agno/docker/resources.py:452-463 — `libs/agno_infra/agno/aws/resources.py` and `libs/agno_infra/agno/docker/resources.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 11 separate duplicated blocks between them, totalling at least 145 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno_infra/agno/docker/resources.py:131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno_infra/agno/docker/resources.py:308` calls `print_info` and `libs/agno_infra/agno/docker/resources.py:144` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–13 lines × 5) · ×1
  • Duplicated block (11–13 lines × 5) libs/agno/agno/db/firestore/firestore.py:941 — libs/agno/agno/db/firestore/firestore.py:941-953 | libs/agno/agno/db/mysql/async_mysql.py:1206-1217 | libs/agno/agno/db/postgres/async_postgres.py:1802-1813 | libs/agno/agno/db/postgres/postgres.py:2032-2042 | libs/agno/agno/db/singlestore/singlestore.py:1254-1264 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (4–13 lines × 8) · ×1
  • Duplicated block (4–13 lines × 8) libs/agno/agno/db/postgres/postgres.py:9466 — libs/agno/agno/db/postgres/postgres.py:9466-9478 | libs/agno/agno/db/postgres/postgres.py:9731-9734 | libs/agno/agno/db/postgres/postgres.py:9756-9759 | libs/agno/agno/db/postgres/postgres.py:9772-9775 | REDACTED:8395-8407 | REDACTED:8660-8663 | REDACTED:8685-8688 | REDACTED:8701-8704 — `libs/agno/agno/db/postgres/postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 291 separate duplicated blocks between them, totalling at least 5395 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) REDACTED:1633 — REDACTED:1633-1641 | REDACTED:1491-1503 — `REDACTED` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 46 separate duplicated blocks between them, totalling at least 897 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (10–12 lines × 11) · ×1
  • Duplicated block (10–12 lines × 11) REDACTED:488 — REDACTED:488-499 | REDACTED:694-705 | REDACTED:428-439 | REDACTED:1106-1117 | REDACTED:1220-1231 | REDACTED:466-475 | REDACTED:1177-1188 | REDACTED:1256-1267 | REDACTED:398-409 | REDACTED:673-684 | REDACTED:405-416 — there are 11 copies across 8 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 11 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:486` calls `exception` and `REDACTED:465` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 9) · ×1
  • Duplicated block (12 lines × 9) cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:95 — cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:95-106 | cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:221-234 | cookbook/07_knowledge/09_archive/vector_dbs/lance_db.py:60-73 | cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py:70-81 | cookbook/07_knowledge/09_archive/vector_dbs/pgvector_db.py:66-77 | cookbook/07_knowledge/09_archive/vector_dbs/pinecone_db.py:75-86 | cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py:78-91 | cookbook/07_knowledge/09_archive/vector_dbs/singlestore_db.py:86-97 | cookbook/07_knowledge/09_archive/vector_dbs/upstash_db.py:69-80 — before extracting anything, compare `cookbook/07_knowledge/09_archive/vector_dbs/milvus_db.py` and `cookbook/07_knowledge/09_archive/vector_dbs/qdrant_db.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cookbook/07_knowledge/09_archive/vector_dbs/couchbase_db.py:213` calls `create_async_agent`, `Agent` and `cookbook/07_knowledge/09_archive/vector_dbs/clickhouse.py:88` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 8) · ×1
  • Duplicated block (12 lines × 8) libs/agno/agno/tools/whatsapp.py:140 — libs/agno/agno/tools/whatsapp.py:140-152 | libs/agno/agno/tools/whatsapp.py:181-192 | libs/agno/agno/tools/whatsapp.py:234-245 | libs/agno/agno/tools/whatsapp.py:309-320 | libs/agno/agno/tools/whatsapp.py:356-367 | libs/agno/agno/tools/whatsapp.py:407-418 | libs/agno/agno/tools/whatsapp.py:454-465 | libs/agno/agno/tools/whatsapp.py:488-502 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–12 lines × 7) · ×1
  • Duplicated block (10–12 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:1825 — libs/agno/agno/db/mysql/async_mysql.py:1825-1836 | libs/agno/agno/db/mysql/mysql.py:1800-1811 | libs/agno/agno/db/postgres/async_postgres.py:2222-2232 | libs/agno/agno/db/postgres/postgres.py:2679-2688 | libs/agno/agno/db/singlestore/singlestore.py:1826-1835 | REDACTED:2329-2339 | REDACTED:2586-2595 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–12 lines × 7) · ×1
  • Duplicated block (11–12 lines × 7) libs/agno/agno/db/mysql/mysql.py:1739 — libs/agno/agno/db/mysql/mysql.py:1739-1749 | libs/agno/agno/db/mysql/mysql.py:2656-2666 | libs/agno/agno/db/postgres/postgres.py:2611-2621 | libs/agno/agno/db/postgres/postgres.py:3603-3613 | libs/agno/agno/db/singlestore/singlestore.py:1776-1786 | libs/agno/agno/db/singlestore/singlestore.py:2652-2662 | REDACTED:2532-2543 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:34 — cookbook/02_agents/10_human_in_the_loop/confirmation_advanced.py:34-45 | cookbook/02_agents/10_human_in_the_loop/confirmation_required.py:34-45 | cookbook/91_tools/python_function_as_tool.py:29-40 | cookbook/91_tools/tool_calls_accesing_agent.py:22-33 | cookbook/91_tools/tool_decorator/cache_tool_calls.py:22-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `num_stories` to `int` in one and `int = 10` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (11–12 lines × 4) · ×1
  • Duplicated block (11–12 lines × 4) libs/agno/agno/knowledge/reader/pdf_reader.py:398 — libs/agno/agno/knowledge/reader/pdf_reader.py:398-408 | libs/agno/agno/knowledge/reader/pdf_reader.py:422-433 | libs/agno/agno/knowledge/reader/pdf_reader.py:448-458 | libs/agno/agno/knowledge/reader/pdf_reader.py:469-480 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–12 lines × 5) · ×1
  • Duplicated block (3–12 lines × 5) libs/agno/agno/tools/gitlab.py:262 — libs/agno/agno/tools/gitlab.py:262-264 | libs/agno/agno/tools/gitlab.py:310-319 | libs/agno/agno/tools/gitlab.py:408-419 | libs/agno/agno/tools/gitlab.py:460-469 | libs/agno/agno/tools/gitlab.py:566-575 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–12 lines × 4) · ×1
  • Duplicated block (9–12 lines × 4) libs/agno/agno/workflow/condition.py:540 — libs/agno/agno/workflow/condition.py:540-548 | libs/agno/agno/workflow/condition.py:763-774 | libs/agno/agno/workflow/condition.py:994-1002 | libs/agno/agno/workflow/condition.py:1216-1227 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:763` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–12 lines × 3) · ×1
  • Duplicated block (9–12 lines × 3) libs/agno/agno/tools/studio_runner.py:485 — libs/agno/agno/tools/studio_runner.py:485-493 | libs/agno/agno/tools/studio_runner.py:516-524 | libs/agno/agno/tools/studio_runner.py:550-561 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/tools/studio_runner.py:550` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) REDACTED:3555 — REDACTED:3555-3566 | REDACTED:4335-4343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3555` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 11) · ×1
  • Duplicated block (9–11 lines × 11) libs/agno/agno/db/mongo/async_mongo.py:754 — libs/agno/agno/db/mongo/async_mongo.py:754-762 | libs/agno/agno/db/mongo/async_mongo.py:2396-2404 | libs/agno/agno/db/mongo/async_mongo.py:3496-3504 | libs/agno/agno/db/mongo/async_mongo.py:3675-3683 | libs/agno/agno/db/mongo/async_mongo.py:3751-3761 | libs/agno/agno/db/mongo/mongo.py:558-566 | libs/agno/agno/db/mongo/mongo.py:2202-2210 | libs/agno/agno/db/mongo/mongo.py:3352-3360 | libs/agno/agno/db/mongo/mongo.py:3479-3487 | libs/agno/agno/db/mongo/mongo.py:3551-3561 | libs/agno/agno/tools/todoist.py:152-160 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `user_id` to `Optional[str] = None` in one and `str` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (10–11 lines × 9) · ×1
  • Duplicated block (10–11 lines × 9) libs/agno/agno/db/mysql/mysql.py:1108 — libs/agno/agno/db/mysql/mysql.py:1108-1118 | libs/agno/agno/db/mysql/mysql.py:1735-1745 | libs/agno/agno/db/mysql/mysql.py:2652-2662 | libs/agno/agno/db/postgres/postgres.py:2607-2617 | libs/agno/agno/db/postgres/postgres.py:3599-3609 | libs/agno/agno/db/singlestore/singlestore.py:1772-1782 | libs/agno/agno/db/singlestore/singlestore.py:2648-2658 | REDACTED:2529-2538 | REDACTED:3459-3468 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/mysql/mysql.py:2650` calls `order_by`, `desc` and `libs/agno/agno/db/mysql/mysql.py:1732` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–11 lines × 7) · ×1
  • Duplicated block (9–11 lines × 7) libs/agno/agno/agent/_run.py:1902 — libs/agno/agno/agent/_run.py:1902-1911 | libs/agno/agno/agent/_run.py:2652-2662 | libs/agno/agno/agent/_run.py:5779-5789 | libs/agno/agno/team/_run.py:3404-3413 | libs/agno/agno/team/_run.py:4085-4094 | libs/agno/agno/team/_run.py:9776-9784 | libs/agno/agno/team/_run.py:10492-10500 — there are 7 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_run.py:2665` calls `create_run_error_event`, `str`, `error_type_of` and `libs/agno/agno/agent/_run.py:1915` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 7) · ×1
  • Duplicated block (11 lines × 7) libs/agno/agno/db/mysql/async_mysql.py:588 — libs/agno/agno/db/mysql/async_mysql.py:588-598 | libs/agno/agno/db/mysql/mysql.py:583-593 | libs/agno/agno/db/postgres/async_postgres.py:885-895 | libs/agno/agno/db/postgres/postgres.py:1040-1050 | libs/agno/agno/db/singlestore/singlestore.py:662-672 | REDACTED:840-850 | REDACTED:1007-1017 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–11 lines × 2) · ×1
  • Duplicated block (7–11 lines × 2) libs/agno/agno/models/anthropic/claude.py:1024 — libs/agno/agno/models/anthropic/claude.py:1024-1034 | libs/agno/agno/models/anthropic/claude.py:1209-1215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/anthropic/claude.py:1024` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–11 lines × 2) · ×1
  • Duplicated block (6–11 lines × 2) libs/agno/agno/os/authz/native_engine.py:302 — libs/agno/agno/os/authz/native_engine.py:302-312 | libs/agno/agno/os/authz/native_engine.py:618-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) libs/agno/agno/os/routers/agents/router.py:2481 — libs/agno/agno/os/routers/agents/router.py:2481-2491 | libs/agno/agno/os/routers/teams/router.py:1277-1284 — `libs/agno/agno/os/routers/agents/router.py` and `libs/agno/agno/os/routers/teams/router.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 38 separate duplicated blocks between them, totalling at least 993 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/agents/router.py:2481` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–10 lines × 12) · ×1
  • Duplicated block (8–10 lines × 12) libs/agno/agno/workflow/workflow.py:3148 — libs/agno/agno/workflow/workflow.py:3148-3157 | libs/agno/agno/workflow/workflow.py:4153-4162 | libs/agno/agno/workflow/workflow.py:7077-7084 | libs/agno/agno/workflow/workflow.py:7158-7166 | libs/agno/agno/workflow/workflow.py:7252-7260 | libs/agno/agno/workflow/workflow.py:7445-7453 | libs/agno/agno/workflow/workflow.py:7936-7943 | libs/agno/agno/workflow/workflow.py:9135-9142 | libs/agno/agno/workflow/workflow.py:9218-9226 | libs/agno/agno/workflow/workflow.py:9310-9318 | libs/agno/agno/workflow/workflow.py:9491-9499 | libs/agno/agno/workflow/workflow.py:9695-9702 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:7074` calls `hasattr`, `_store_continue_executor_response` and `libs/agno/agno/workflow/workflow.py:3145` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 9) · ×1
  • Duplicated block (10 lines × 9) libs/agno/agno/db/mongo/async_mongo.py:752 — libs/agno/agno/db/mongo/async_mongo.py:752-761 | libs/agno/agno/db/mongo/async_mongo.py:2394-2403 | libs/agno/agno/db/mongo/async_mongo.py:3673-3682 | libs/agno/agno/db/mongo/mongo.py:556-565 | libs/agno/agno/db/mongo/mongo.py:2200-2209 | libs/agno/agno/db/mongo/mongo.py:3477-3486 | libs/agno/agno/db/redis/redis.py:520-529 | libs/agno/agno/db/valkey/valkey.py:606-615 | libs/agno/agno/tools/todoist.py:150-159 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `user_id` to `Optional[str] = None` in one and `str` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (9–10 lines × 8) · ×1
  • Duplicated block (9–10 lines × 8) libs/agno/agno/agent/_run.py:727 — libs/agno/agno/agent/_run.py:727-735 | libs/agno/agno/agent/_run.py:1270-1278 | libs/agno/agno/agent/_run.py:1898-1907 | libs/agno/agno/agent/_run.py:2648-2657 | libs/agno/agno/team/_run.py:1398-1406 | libs/agno/agno/team/_run.py:1862-1870 | libs/agno/agno/team/_run.py:3401-3409 | libs/agno/agno/team/_run.py:4082-4090 — there are 8 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8–10 lines × 8) · ×1
  • Duplicated block (8–10 lines × 8) libs/agno/agno/agent/_run.py:1900 — libs/agno/agno/agent/_run.py:1900-1909 | libs/agno/agno/agent/_run.py:2650-2659 | libs/agno/agno/agent/_run.py:5140-5149 | libs/agno/agno/agent/_run.py:5777-5786 | libs/agno/agno/team/_run.py:3402-3411 | libs/agno/agno/team/_run.py:4083-4092 | libs/agno/agno/team/_run.py:9775-9782 | libs/agno/agno/team/_run.py:10491-10498 — there are 8 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/agent/_run.py:5152` calls `RunOutput` and `libs/agno/agno/agent/_run.py:1911` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 6) · ×1
  • Duplicated block (8–10 lines × 6) libs/agno/agno/db/gcs_json/gcs_json_db.py:1502 — libs/agno/agno/db/gcs_json/gcs_json_db.py:1502-1509 | libs/agno/agno/db/in_memory/in_memory_db.py:517-524 | libs/agno/agno/db/in_memory/in_memory_db.py:1319-1326 | libs/agno/agno/db/json/json_db.py:1602-1609 | libs/agno/agno/db/redis/redis.py:1860-1867 | libs/agno/agno/db/valkey/valkey.py:2289-2298 — `libs/agno/agno/db/gcs_json/gcs_json_db.py` and `libs/agno/agno/db/in_memory/in_memory_db.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 16 separate duplicated blocks between them, totalling at least 336 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–10 lines × 7) · ×1
  • Duplicated block (3–10 lines × 7) libs/agno/agno/tools/google/gmail.py:415 — libs/agno/agno/tools/google/gmail.py:415-424 | libs/agno/agno/tools/google/gmail.py:449-458 | libs/agno/agno/tools/google/gmail.py:481-490 | libs/agno/agno/tools/google/gmail.py:534-543 | libs/agno/agno/tools/google/gmail.py:567-576 | libs/agno/agno/tools/google/gmail.py:612-614 | libs/agno/agno/tools/google/gmail.py:837-846 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/tools/google/gmail.py:415` calls `_get_message_details`, `get` and `libs/agno/agno/tools/google/gmail.py:612` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) libs/agno/agno/models/cohere/chat.py:221 — libs/agno/agno/models/cohere/chat.py:221-230 | libs/agno/agno/models/cohere/chat.py:287-296 | libs/agno/agno/models/ibm/watsonx.py:189-197 | libs/agno/agno/models/ibm/watsonx.py:226-234 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/cohere/chat.py:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6–10 lines × 3) · ×1
  • Duplicated block (6–10 lines × 3) libs/agno/agno/knowledge/chunking/document.py:42 — libs/agno/agno/knowledge/chunking/document.py:42-47 | libs/agno/agno/knowledge/chunking/document.py:67-76 | libs/agno/agno/knowledge/chunking/document.py:100-105 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/knowledge/chunking/document.py:67` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) libs/agno_infra/agno/aws/resource/ecs/service.py:134 — libs/agno_infra/agno/aws/resource/ecs/service.py:134-142 | libs/agno_infra/agno/aws/resource/ecs/service.py:353-361 | libs/agno_infra/agno/aws/resource/elb/load_balancer.py:43-52 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9 lines × 17) · ×1
  • Duplicated block (9 lines × 17) libs/agno/agno/os/interfaces/a2a/utils.py:383 — libs/agno/agno/os/interfaces/a2a/utils.py:383-391 | libs/agno/agno/os/interfaces/a2a/utils.py:402-410 | libs/agno/agno/os/interfaces/a2a/utils.py:487-495 | libs/agno/agno/os/interfaces/a2a/utils.py:502-510 | libs/agno/agno/os/interfaces/a2a/utils.py:519-527 | libs/agno/agno/os/interfaces/a2a/utils.py:537-545 | libs/agno/agno/os/interfaces/a2a/utils.py:556-564 | libs/agno/agno/os/interfaces/a2a/utils.py:575-583 | libs/agno/agno/os/interfaces/a2a/utils.py:592-600 | libs/agno/agno/os/interfaces/a2a/utils.py:610-618 | libs/agno/agno/os/interfaces/a2a/utils.py:627-635 | libs/agno/agno/os/interfaces/a2a/utils.py:645-653 | libs/agno/agno/os/interfaces/a2a/utils.py:664-672 | libs/agno/agno/os/interfaces/a2a/utils.py:682-690 | libs/agno/agno/os/interfaces/a2a/utils.py:701-709 | libs/agno/agno/os/interfaces/a2a/utils.py:719-727 | libs/agno/agno/os/interfaces/a2a/utils.py:738-746 — all 17 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/interfaces/a2a/utils.py:589` calls `hasattr` and `libs/agno/agno/os/interfaces/a2a/utils.py:484` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 14) · ×1
  • Duplicated block (9 lines × 14) libs/agno/agno/db/mongo/async_mongo.py:753 — libs/agno/agno/db/mongo/async_mongo.py:753-762 | libs/agno/agno/db/mongo/async_mongo.py:2395-2404 | libs/agno/agno/db/mongo/async_mongo.py:3495-3504 | libs/agno/agno/db/mongo/async_mongo.py:3674-3683 | libs/agno/agno/db/mongo/async_mongo.py:3752-3761 | libs/agno/agno/db/mongo/mongo.py:557-566 | libs/agno/agno/db/mongo/mongo.py:2201-2210 | libs/agno/agno/db/mongo/mongo.py:3351-3360 | libs/agno/agno/db/mongo/mongo.py:3478-3487 | libs/agno/agno/db/mongo/mongo.py:3552-3561 | libs/agno/agno/db/redis/redis.py:521-529 | libs/agno/agno/db/valkey/valkey.py:607-615 | libs/agno/agno/tools/seltz.py:139-148 | libs/agno/agno/tools/todoist.py:151-160 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `user_id` to `Optional[str] = None` in one and `str` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8–9 lines × 13) · ×1
  • Duplicated block (8–9 lines × 13) libs/agno/agno/db/dynamo/utils.py:422 — libs/agno/agno/db/dynamo/utils.py:422-429 | libs/agno/agno/db/firestore/utils.py:263-270 | libs/agno/agno/db/gcs_json/utils.py:119-126 | libs/agno/agno/db/in_memory/utils.py:119-126 | libs/agno/agno/db/json/utils.py:119-126 | libs/agno/agno/db/mongo/utils.py:205-212 | libs/agno/agno/db/mysql/utils.py:300-307 | libs/agno/agno/db/postgres/utils.py:351-359 | libs/agno/agno/db/redis/utils.py:264-271 | libs/agno/agno/db/singlestore/utils.py:327-334 | libs/agno/agno/db/sqlite/utils.py:316-324 | libs/agno/agno/db/surrealdb/metrics.py:341-348 | libs/agno/agno/db/valkey/utils.py:459-466 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/firestore/utils.py:273` calls `sha256`, `encode`, `hexdigest` and `libs/agno/agno/db/dynamo/utils.py:430` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 9) · ×1
  • Duplicated block (8–9 lines × 9) libs/agno/agno/db/mongo/async_mongo.py:951 — libs/agno/agno/db/mongo/async_mongo.py:951-958 | libs/agno/agno/db/mongo/mongo.py:761-768 | libs/agno/agno/db/mysql/async_mysql.py:1009-1017 | libs/agno/agno/db/mysql/mysql.py:1003-1010 | libs/agno/agno/db/postgres/async_postgres.py:1589-1597 | libs/agno/agno/db/postgres/postgres.py:1821-1828 | libs/agno/agno/db/singlestore/singlestore.py:1058-1065 | REDACTED:1519-1527 | REDACTED:1777-1784 — before extracting anything, compare `libs/agno/agno/db/mongo/async_mongo.py` and `libs/agno/agno/db/mongo/mongo.py` as WHOLE FILES: this scan already matched 65 separate duplicated blocks between them, totalling at least 1121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1009` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 8) · ×1
  • Duplicated block (8–9 lines × 8) libs/agno/agno/workflow/workflow.py:3019 — libs/agno/agno/workflow/workflow.py:3019-3027 | libs/agno/agno/workflow/workflow.py:3414-3422 | libs/agno/agno/workflow/workflow.py:4024-4032 | libs/agno/agno/workflow/workflow.py:4443-4451 | libs/agno/agno/workflow/workflow.py:7311-7318 | libs/agno/agno/workflow/workflow.py:8257-8264 | libs/agno/agno/workflow/workflow.py:9361-9368 | libs/agno/agno/workflow/workflow.py:10017-10024 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:3016` calls `raise_if_cancelled` and `libs/agno/agno/workflow/workflow.py:3411` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) libs/agno/agno/models/message.py:184 — libs/agno/agno/models/message.py:184-192 | libs/agno/agno/models/message.py:256-263 | libs/agno/agno/utils/media.py:397-404 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/models/message.py:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) libs/agno/agno/learn/stores/entity_memory.py:628 — libs/agno/agno/learn/stores/entity_memory.py:628-636 | libs/agno/agno/learn/stores/entity_memory.py:660-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (3–9 lines × 3) · ×1
  • Duplicated block (3–9 lines × 3) libs/agno/agno/os/authz/admin_router.py:508 — libs/agno/agno/os/authz/admin_router.py:508-516 | libs/agno/agno/os/authz/admin_router.py:535-546 | libs/agno/agno/os/authz/admin_router.py:756-758 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/authz/admin_router.py:508` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: `Authorization` names `agno.os` in one and `agno.os.authz.authorization` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8 lines × 24) · ×1
  • Duplicated block (8 lines × 24) libs/agno/agno/workflow/workflow.py:3153 — libs/agno/agno/workflow/workflow.py:3153-3160 | libs/agno/agno/workflow/workflow.py:3507-3514 | libs/agno/agno/workflow/workflow.py:3525-3532 | libs/agno/agno/workflow/workflow.py:4158-4165 | libs/agno/agno/workflow/workflow.py:4548-4555 | libs/agno/agno/workflow/workflow.py:4565-4572 | libs/agno/agno/workflow/workflow.py:7080-7087 | libs/agno/agno/workflow/workflow.py:7162-7169 | libs/agno/agno/workflow/workflow.py:7256-7263 | libs/agno/agno/workflow/workflow.py:7449-7456 | libs/agno/agno/workflow/workflow.py:7939-7946 | libs/agno/agno/workflow/workflow.py:8065-8072 | libs/agno/agno/workflow/workflow.py:8196-8203 | libs/agno/agno/workflow/workflow.py:8348-8355 | libs/agno/agno/workflow/workflow.py:8363-8370 | libs/agno/agno/workflow/workflow.py:9138-9145 | libs/agno/agno/workflow/workflow.py:9222-9229 | libs/agno/agno/workflow/workflow.py:9314-9321 | libs/agno/agno/workflow/workflow.py:9495-9502 | libs/agno/agno/workflow/workflow.py:9698-9705 | libs/agno/agno/workflow/workflow.py:9824-9831 | libs/agno/agno/workflow/workflow.py:9956-9963 | libs/agno/agno/workflow/workflow.py:10108-10115 | libs/agno/agno/workflow/workflow.py:10123-10130 — all 24 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/workflow/workflow.py:3150` calls `_check_failed_step` and `libs/agno/agno/workflow/workflow.py:8063` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) libs/agno/agno/tools/google/gmail.py:417 — libs/agno/agno/tools/google/gmail.py:417-424 | libs/agno/agno/tools/google/gmail.py:451-458 | libs/agno/agno/tools/google/gmail.py:483-490 | libs/agno/agno/tools/google/gmail.py:536-543 | libs/agno/agno/tools/google/gmail.py:569-576 | libs/agno/agno/tools/google/gmail.py:616-623 | libs/agno/agno/tools/google/gmail.py:839-846 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6–8 lines × 5) · ×1
  • Duplicated block (6–8 lines × 5) REDACTED:598 — REDACTED:598-603 | REDACTED:618-625 | REDACTED:636-641 | REDACTED:654-659 | REDACTED:886-893 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:617` calls `where` and `REDACTED:597` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 4) · ×1
  • Duplicated block (7–8 lines × 4) libs/agno/agno/db/mysql/mysql.py:918 — libs/agno/agno/db/mysql/mysql.py:918-924 | libs/agno/agno/db/postgres/postgres.py:1495-1502 | libs/agno/agno/db/singlestore/singlestore.py:972-978 | REDACTED:1474-1481 — `libs/agno/agno/db/mysql/mysql.py` and `libs/agno/agno/db/postgres/postgres.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 99 separate duplicated blocks between them, totalling at least 1692 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1466` calls `execute`, `where`, `in_` and `libs/agno/agno/db/mysql/mysql.py:917` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–8 lines × 8) · ×1
  • Duplicated block (3–8 lines × 8) libs/agno/agno/db/postgres/async_postgres.py:6734 — libs/agno/agno/db/postgres/async_postgres.py:6734-6737 | libs/agno/agno/db/postgres/async_postgres.py:6997-6999 | libs/agno/agno/db/postgres/async_postgres.py:7026-7028 | libs/agno/agno/db/postgres/async_postgres.py:7044-7051 | REDACTED:5903-5906 | REDACTED:6166-6168 | REDACTED:6195-6197 | REDACTED:6213-6220 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/postgres/async_postgres.py:6734` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:7043` calls `async_session_factory`, `begin`, `run_sync` and `libs/agno/agno/db/postgres/async_postgres.py:6734` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–8 lines × 3) · ×1
  • Duplicated block (3–8 lines × 3) libs/agno/agno/db/surrealdb/surrealdb.py:1860 — libs/agno/agno/db/surrealdb/surrealdb.py:1860-1862 | libs/agno/agno/db/surrealdb/surrealdb.py:2157-2164 | libs/agno/agno/db/surrealdb/surrealdb.py:2191-2197 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) libs/agno/agno/knowledge/reader/csv_reader.py:166 — libs/agno/agno/knowledge/reader/csv_reader.py:166-173 | libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:192-197 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/knowledge/reader/field_labeled_csv_reader.py:198` calls `getattr`, `split` and `libs/agno/agno/knowledge/reader/csv_reader.py:174` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (2–8 lines × 3) · ×1
  • Duplicated block (2–8 lines × 3) libs/agno/agno/utils/media_offload.py:361 — libs/agno/agno/utils/media_offload.py:361-368 | libs/agno/agno/utils/media_offload.py:635-642 | libs/agno/agno/utils/media_offload.py:647-648 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/utils/media_offload.py:642` calls `log_warning`, `iter_step_outputs` and `libs/agno/agno/utils/media_offload.py:648` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 23) · ×1
  • Duplicated block (7 lines × 23) libs/agno/agno/db/mysql/async_mysql.py:761 — libs/agno/agno/db/mysql/async_mysql.py:761-767 | libs/agno/agno/db/mysql/async_mysql.py:2655-2661 | libs/agno/agno/db/mysql/mysql.py:751-757 | libs/agno/agno/db/mysql/mysql.py:2624-2630 | libs/agno/agno/db/postgres/async_postgres.py:1100-1106 | libs/agno/agno/db/postgres/async_postgres.py:3029-3035 | libs/agno/agno/db/postgres/async_postgres.py:4265-4271 | libs/agno/agno/db/postgres/postgres.py:1249-1255 | libs/agno/agno/db/postgres/postgres.py:3573-3579 | libs/agno/agno/db/postgres/postgres.py:6740-6746 | libs/agno/agno/db/postgres/postgres.py:6934-6940 | libs/agno/agno/db/postgres/postgres.py:6998-7004 | libs/agno/agno/db/singlestore/singlestore.py:808-814 | libs/agno/agno/db/singlestore/singlestore.py:2620-2626 | REDACTED:1051-1057 | REDACTED:3180-3186 | REDACTED:4142-4148 | REDACTED:4339-4345 | REDACTED:1236-1242 | REDACTED:3433-3439 | REDACTED:6511-6517 | REDACTED:6705-6711 | REDACTED:6767-6773 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/mysql/async_mysql.py:2664` calls `where` and `libs/agno/agno/db/postgres/postgres.py:3581` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 16) · ×1
  • Duplicated block (7 lines × 16) libs/agno/agno/db/postgres/async_postgres.py:6437 — libs/agno/agno/db/postgres/async_postgres.py:6437-6443 | libs/agno/agno/db/postgres/async_postgres.py:6548-6554 | libs/agno/agno/db/postgres/async_postgres.py:6666-6672 | libs/agno/agno/db/postgres/async_postgres.py:6914-6920 | libs/agno/agno/db/postgres/postgres.py:9190-9196 | libs/agno/agno/db/postgres/postgres.py:9295-9301 | libs/agno/agno/db/postgres/postgres.py:9411-9417 | libs/agno/agno/db/postgres/postgres.py:9649-9655 | REDACTED:5606-5612 | REDACTED:5717-5723 | REDACTED:5835-5841 | REDACTED:6083-6089 | REDACTED:8119-8125 | REDACTED:8224-8230 | REDACTED:8340-8346 | REDACTED:8578-8584 — before extracting anything, compare `libs/agno/agno/db/postgres/async_postgres.py` and `libs/agno/agno/db/postgres/postgres.py` as WHOLE FILES: this scan already matched 160 separate duplicated blocks between them, totalling at least 2144 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 12) · ×1
  • Duplicated block (7 lines × 12) libs/agno/agno/db/dynamo/utils.py:494 — libs/agno/agno/db/dynamo/utils.py:494-500 | libs/agno/agno/db/firestore/utils.py:311-318 | libs/agno/agno/db/gcs_json/utils.py:182-189 | libs/agno/agno/db/in_memory/utils.py:182-189 | libs/agno/agno/db/json/utils.py:182-189 | libs/agno/agno/db/mongo/utils.py:249-256 | libs/agno/agno/db/mysql/utils.py:360-367 | libs/agno/agno/db/postgres/utils.py:412-419 | libs/agno/agno/db/redis/utils.py:319-326 | libs/agno/agno/db/singlestore/utils.py:387-394 | libs/agno/agno/db/sqlite/utils.py:377-384 | libs/agno/agno/db/valkey/utils.py:514-521 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (3–7 lines × 4) · ×1
  • Duplicated block (3–7 lines × 4) libs/agno/agno/workflow/condition.py:308 — libs/agno/agno/workflow/condition.py:308-310 | libs/agno/agno/workflow/loop.py:358-364 | libs/agno/agno/workflow/parallel.py:163-169 | libs/agno/agno/workflow/steps.py:181-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/workflow/condition.py:308` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) libs/agno_infra/agno/infra/operator.py:226 — libs/agno_infra/agno/infra/operator.py:226-232 | libs/agno_infra/agno/infra/operator.py:300-305 | libs/agno_infra/agno/infra/operator.py:372-377 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–7 lines × 3) · ×1
  • Duplicated block (4–7 lines × 3) libs/agno/agno/db/mysql/async_mysql.py:2957 — libs/agno/agno/db/mysql/async_mysql.py:2957-2960 | libs/agno/agno/db/mysql/mysql.py:2925-2931 | libs/agno/agno/db/singlestore/singlestore.py:2865-2871 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:2957` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–7 lines × 3) · ×1
  • Duplicated block (3–7 lines × 3) libs/agno/agno/os/routers/session/session.py:522 — libs/agno/agno/os/routers/session/session.py:522-528 | libs/agno/agno/os/routers/session/session.py:1156-1162 | libs/agno/agno/os/routers/session/session.py:1261-1263 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/os/routers/session/session.py:522` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/os/routers/session/session.py:1153` calls `Body` and `libs/agno/agno/os/routers/session/session.py:519` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 33) · ×1
  • Duplicated block (6 lines × 33) libs/agno/agno/db/mysql/async_mysql.py:760 — libs/agno/agno/db/mysql/async_mysql.py:760-765 | libs/agno/agno/db/mysql/async_mysql.py:1735-1740 | libs/agno/agno/db/mysql/mysql.py:750-755 | libs/agno/agno/db/mysql/mysql.py:1716-1721 | libs/agno/agno/db/postgres/async_postgres.py:1099-1104 | libs/agno/agno/db/postgres/async_postgres.py:2134-2139 | libs/agno/agno/db/postgres/async_postgres.py:3028-3033 | libs/agno/agno/db/postgres/async_postgres.py:4008-4013 | libs/agno/agno/db/postgres/async_postgres.py:4201-4206 | libs/agno/agno/db/postgres/async_postgres.py:4264-4269 | libs/agno/agno/db/postgres/async_postgres.py:4337-4342 | libs/agno/agno/db/postgres/postgres.py:1248-1253 | libs/agno/agno/db/postgres/postgres.py:2591-2596 | libs/agno/agno/db/postgres/postgres.py:3572-3577 | libs/agno/agno/db/postgres/postgres.py:6739-6744 | libs/agno/agno/db/postgres/postgres.py:6933-6938 | libs/agno/agno/db/postgres/postgres.py:6997-7002 | libs/agno/agno/db/postgres/postgres.py:7068-7073 | libs/agno/agno/db/singlestore/singlestore.py:807-812 | libs/agno/agno/db/singlestore/singlestore.py:1755-1760 | REDACTED:1050-1055 | REDACTED:2256-2261 | REDACTED:3179-3184 | REDACTED:4141-4146 | REDACTED:4338-4343 | REDACTED:4409-4414 | REDACTED:1235-1240 | REDACTED:2513-2518 | REDACTED:3432-3437 | REDACTED:6510-6515 | REDACTED:6704-6709 | REDACTED:6766-6771 | REDACTED:6836-6841 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `user_id` to `Optional[str] = None` in one and `str` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/postgres/async_postgres.py:4335` calls `where`, `is_` and `libs/agno/agno/db/mysql/async_mysql.py:759` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 13) · ×1
  • Duplicated block (6 lines × 13) libs/agno/agno/db/dynamo/utils.py:408 — libs/agno/agno/db/dynamo/utils.py:408-413 | libs/agno/agno/db/firestore/utils.py:246-251 | libs/agno/agno/db/gcs_json/utils.py:104-109 | libs/agno/agno/db/in_memory/utils.py:104-109 | libs/agno/agno/db/json/utils.py:104-109 | libs/agno/agno/db/mongo/utils.py:188-193 | libs/agno/agno/db/mysql/utils.py:286-291 | libs/agno/agno/db/postgres/utils.py:336-341 | libs/agno/agno/db/redis/utils.py:250-255 | libs/agno/agno/db/singlestore/utils.py:313-318 | libs/agno/agno/db/sqlite/utils.py:298-303 | libs/agno/agno/db/surrealdb/metrics.py:325-330 | libs/agno/agno/db/valkey/utils.py:445-450 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/db/firestore/utils.py:244` calls `isinstance`, `loads` and `libs/agno/agno/db/dynamo/utils.py:407` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 8) · ×1
  • Duplicated block (6 lines × 8) libs/agno/agno/team/_run.py:1408 — libs/agno/agno/team/_run.py:1408-1413 | libs/agno/agno/team/_run.py:1872-1877 | libs/agno/agno/team/_run.py:3411-3416 | libs/agno/agno/team/_run.py:4092-4097 | libs/agno/agno/team/_run.py:8348-8353 | libs/agno/agno/team/_run.py:8630-8635 | libs/agno/agno/team/_run.py:9782-9787 | libs/agno/agno/team/_run.py:10498-10503 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:1105 — libs/agno/agno/db/mysql/async_mysql.py:1105-1110 | libs/agno/agno/db/mysql/mysql.py:1099-1104 | libs/agno/agno/db/postgres/async_postgres.py:1688-1693 | libs/agno/agno/db/postgres/postgres.py:1920-1925 | libs/agno/agno/db/singlestore/singlestore.py:1154-1160 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `libs/agno/agno/db/mysql/async_mysql.py:1105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) REDACTED:219 — REDACTED:219-223 | REDACTED:881-886 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 16) · ×1
  • Duplicated block (5 lines × 16) libs/agno/agno/db/postgres/async_postgres.py:6440 — libs/agno/agno/db/postgres/async_postgres.py:6440-6444 | libs/agno/agno/db/postgres/async_postgres.py:6467-6471 | libs/agno/agno/db/postgres/async_postgres.py:6551-6555 | libs/agno/agno/db/postgres/async_postgres.py:6577-6581 | libs/agno/agno/db/postgres/async_postgres.py:6669-6673 | libs/agno/agno/db/postgres/async_postgres.py:6703-6707 | libs/agno/agno/db/postgres/async_postgres.py:6917-6921 | libs/agno/agno/db/postgres/async_postgres.py:6970-6974 | REDACTED:5609-5613 | REDACTED:5636-5640 | REDACTED:5720-5724 | REDACTED:5746-5750 | REDACTED:5838-5842 | REDACTED:5872-5876 | REDACTED:6086-6090 | REDACTED:6139-6143 — `libs/agno/agno/db/postgres/async_postgres.py` and `REDACTED` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 243 separate duplicated blocks between them, totalling at least 3610 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (5 lines × 11) · ×1
  • Duplicated block (5 lines × 11) libs/agno/agno/db/dynamo/utils.py:416 — libs/agno/agno/db/dynamo/utils.py:416-420 | libs/agno/agno/db/firestore/utils.py:257-261 | libs/agno/agno/db/gcs_json/utils.py:112-116 | libs/agno/agno/db/in_memory/utils.py:112-116 | libs/agno/agno/db/json/utils.py:112-116 | libs/agno/agno/db/mongo/utils.py:199-203 | libs/agno/agno/db/mysql/utils.py:294-298 | libs/agno/agno/db/postgres/utils.py:345-349 | libs/agno/agno/db/redis/utils.py:258-262 | libs/agno/agno/db/singlestore/utils.py:321-325 | libs/agno/agno/db/valkey/utils.py:453-457 — `libs/agno/agno/db/dynamo/utils.py` and `libs/agno/agno/db/firestore/utils.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 129 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/gcs_json/utils.py:117` calls `isoformat` and `libs/agno/agno/db/dynamo/utils.py:422` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) libs/agno/agno/team/_run.py:553 — libs/agno/agno/team/_run.py:553-557 | libs/agno/agno/team/_run.py:1061-1065 | libs/agno/agno/team/_run.py:1413-1422 | libs/agno/agno/team/_run.py:1877-1883 | libs/agno/agno/team/_run.py:8353-8357 | libs/agno/agno/team/_run.py:8635-8639 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) libs/agno/agno/db/mysql/async_mysql.py:2727 — libs/agno/agno/db/mysql/async_mysql.py:2727-2731 | libs/agno/agno/db/mysql/mysql.py:2696-2700 | libs/agno/agno/db/singlestore/singlestore.py:2692-2696 | REDACTED:3252-3256 | REDACTED:3505-3509 — before extracting anything, compare `libs/agno/agno/db/mysql/async_mysql.py` and `libs/agno/agno/db/mysql/mysql.py` as WHOLE FILES: this scan already matched 89 separate duplicated blocks between them, totalling at least 1415 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3261` calls `log_debug` and `libs/agno/agno/db/mysql/async_mysql.py:2735` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) libs/agno/agno/db/schemas/products.py:7 — libs/agno/agno/db/schemas/products.py:7-11 | libs/agno/agno/db/schemas/projects.py:15-19 | libs/agno/agno/db/schemas/tasks.py:33-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libs/agno/agno/db/schemas/projects.py:19` calls `isinstance`, `strip`, `ValueError` and `libs/agno/agno/db/schemas/tasks.py:36` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 18) · ×1
  • Duplicated block (5 lines × 18) cookbook/07_knowledge/04_advanced/07_per_user_isolation/cassandra_db.py:44 — cookbook/07_knowledge/04_advanced/07_per_user_isolation/cassandra_db.py:44-48 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/chroma_db.py:39-43 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/clickhouse_db.py:46-50 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/couchbase_db.py:136-140 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/elasticsearch_db.py:46-50 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/lance_db.py:42-46 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/milvus_db.py:45-49 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/mongo_db.py:43-47 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/opensearch_db.py:44-48 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/pgvector_db.py:38-42 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/pinecone_db.py:43-47 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/qdrant_db.py:43-47 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/redis_db.py:42-46 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/singlestore_db.py:51-55 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/surreal_db.py:48-52 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/upstash_db.py:44-48 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/valkey_db.py:48-52 | cookbook/07_knowledge/04_advanced/07_per_user_isolation/weaviate_db.py:41-45 — before extracting anything, compare `cookbook/07_knowledge/04_advanced/07_per_user_isolation/cassandra_db.py` and `cookbook/07_knowledge/04_advanced/07_per_user_isolation/pgvector_db.py` as WHOLE FILES: 82% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14 lines × 6) · ×1
  • Duplicated block (14 lines × 6) libs/agno/agno/agent/agent.py:829 — libs/agno/agno/agent/agent.py:829-844 | libs/agno/agno/agents/base.py:318-331 | libs/agno/agno/factory/base.py:83-96 | libs/agno/agno/remote/base.py:434-449 | libs/agno/agno/team/team.py:748-765 | libs/agno/agno/workflow/workflow.py:791-808 — `libs/agno/agno/agent/agent.py` and `libs/agno/agno/team/team.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 9 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (14 lines × 21) · ×1
  • Duplicated block (14 lines × 21) libs/agno/agno/models/aimlapi/aimlapi.py:49 — libs/agno/agno/models/aimlapi/aimlapi.py:49-63 | libs/agno/agno/models/cerebras/cerebras_openai.py:25-38 | libs/agno/agno/models/cometapi/cometapi.py:31-44 | libs/agno/agno/models/deepinfra/deepinfra.py:32-45 | libs/agno/agno/models/fireworks/fireworks.py:30-43 | libs/agno/agno/models/flexai/flexai.py:30-43 | libs/agno/agno/models/heabsy/heabsy.py:30-43 | libs/agno/agno/models/internlm/internlm.py:30-43 | libs/agno/agno/models/litellm/litellm_openai.py:29-42 | libs/agno/agno/models/meta/llama_openai.py:54-67 | libs/agno/agno/models/neosantara/neosantara.py:29-42 | libs/agno/agno/models/nvidia/nvidia.py:32-45 | libs/agno/agno/models/openrouter/openrouter.py:43-58 | libs/agno/agno/models/perplexity/perplexity.py:56-69 | libs/agno/agno/models/requesty/requesty.py:35-48 | libs/agno/agno/models/sambanova/sambanova.py:32-45 | libs/agno/agno/models/siliconflow/siliconflow.py:29-42 | libs/agno/agno/models/together/together.py:29-42 | libs/agno/agno/models/vercel/v0.py:30-43 | libs/agno/agno/models/xai/xai.py:44-57 | libs/agno/agno/models/yapi/yapi.py:31-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 21 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 21 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libs/agno/agno/models/cerebras/cerebras_openai.py:22` calls `field`, `getenv` and `libs/agno/agno/models/neosantara/neosantara.py:26` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17 lines × 10) · ×1
  • Duplicated block (17 lines × 10) libs/agno/agno/models/anthropic/claude.py:461 — libs/agno/agno/models/anthropic/claude.py:461-484 | libs/agno/agno/models/aws/bedrock.py:262-279 | libs/agno/agno/models/cohere/chat.py:113-135 | libs/agno/agno/models/google/gemini.py:220-256 | libs/agno/agno/models/groq/groq.py:189-214 | libs/agno/agno/models/huggingface/huggingface.py:169-192 | libs/agno/agno/models/meta/llama.py:183-204 | libs/agno/agno/models/mistral/mistral.py:169-190 | libs/agno/agno/models/ollama/chat.py:132-148 | libs/agno/agno/models/openai/chat.py:272-305 — before extracting anything, compare `libs/agno/agno/models/groq/groq.py` and `libs/agno/agno/models/openai/chat.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D8 · Code Coverage · Coverage not measured · ×1
  • Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — cookbook/05_agent_os/16_agui/openui/frontend/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
P8 · Schema migrations · Schema created by SQLAlchemy create_all() (no migration path) · ×1
  • Schema created by SQLAlchemy create_all() (no migration path) REDACTED:202 — SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment.
R2 · Cyclomatic Complexity · Cyclomatic Complexity · ×1
  • Cyclomatic Complexity — P95 cyclomatic 10 · 0 function(s) > 10 · 0 > 20 (of 16)
R8 · Dependency Hygiene · Unused dependency '@openuidev/cli' · ×1
  • Unused dependency '@openuidev/cli' — Declared in cookbook/05_agent_os/16_agui/openui/frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency '@openuidev/react-headless' · ×1
  • Unused dependency '@openuidev/react-headless' — Declared in cookbook/05_agent_os/16_agui/openui/frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency '@openuidev/react-lang' · ×1
  • Unused dependency '@openuidev/react-lang' — Declared in cookbook/05_agent_os/16_agui/openui/frontend/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
S1 · Web-Security Posture · Third-party script without Subresource Integrity · ×1
  • Third-party script without Subresource Integrity cookbook/data_labeling/image_search/public/index.html:8 — `https://cdn.tailwindcss.com` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 3 such include(s) across the repository's markup.
SC1 · Supply-chain hygiene · JavaScript dependencies are not locked · ×1
  • JavaScript dependencies are not locked — No package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock — JS installs aren't reproducible (SSDF PW.4.4). Commit your package manager's lockfile and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Minor — 538 finding(s)
D29 · Static Analysis (SAST) · REDACTED · ×283
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 258 more in this group — see findings.md.
D34 · Knowledge Freshness · Orphaned file · ×180
  • Orphaned file libs/agno/agno/tools/memory.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file cookbook/04_workflows/06_advanced_concepts/background_execution/websocket_client.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/utils/streamlit.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file cookbook/91_tools/trafilatura_tools.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/filters.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/visualization.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/workflow/remote.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/trafilatura.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/knowledge/embedder/cohere.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/brightdata.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno_infra/agno/infra/config.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/salesforce.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/opencv.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/bitbucket.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/knowledge/reranker/aws_bedrock.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/scrapegraph.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/knowledge/remote_content/s3.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/knowledge/embedder/azure_openai.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file cookbook/91_tools/websearch_tools_advanced.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/financial_datasets.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file cookbook/04_workflows/06_advanced_concepts/background_execution/websocket_server.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/confluence.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/valyu.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/tools/trello.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file libs/agno/agno/os/routers/evals/schemas.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 155 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate libs/agno/agno/reasoning/azure_ai_foundry.py:41 — `"<think>" in content and "</think>" in content` appears character-identically in 4 files — libs/agno/agno/reasoning/azure_ai_foundry.py, libs/agno/agno/reasoning/groq.py, libs/agno/agno/reasoning/ollama.py, libs/agno/agno/reasoning/openai.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/dynamo/dynamo.py:3126 — `"attributes" in span_data and isinstance(span_data["attributes"], str)` appears character-identically in 2 files — libs/agno/agno/db/dynamo/dynamo.py, libs/agno/agno/db/firestore/firestore.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/dynamo/dynamo.py:3015 — `"attributes" in span_dict and isinstance(span_dict["attributes"], dict)` appears character-identically in 2 files — libs/agno/agno/db/dynamo/dynamo.py, libs/agno/agno/db/firestore/firestore.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/tools/gandr.py:148 — `"audio" not in content_type and "octet-stream" not in content_type` appears character-identically in 2 files — libs/agno/agno/tools/gandr.py, libs/agno/agno/tools/smallest.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate cookbook/04_workflows/05_conditional_branching/selector_types.py:51 — `"business" in topic or "market" in topic or "finance" in topic` appears character-identically in 2 files — cookbook/04_workflows/05_conditional_branching/selector_types.py, cookbook/04_workflows/05_conditional_branching/string_selector.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/postgres/async_postgres.py:6495 — `"config" not in fields and isinstance(candidate.get("config"), dict)` appears character-identically in 4 files — libs/agno/agno/db/postgres/async_postgres.py, libs/agno/agno/db/postgres/postgres.py, REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:182 — `"content" in aud_data and isinstance(aud_data["content"], str)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:231 — `"content" in file_data and isinstance(file_data["content"], str)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:159 — `"content" in img_data and isinstance(img_data["content"], str)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:208 — `"content" in vid_data and isinstance(vid_data["content"], str)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/agent/_storage.py:1324 — `"db" in config and isinstance(config["db"], dict)` appears character-identically in 3 files — libs/agno/agno/agent/_storage.py, libs/agno/agno/team/_storage.py, libs/agno/agno/workflow/workflow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/mysql/async_mysql.py:2456 — `"id" in table_columns and knowledge_row.id` appears character-identically in 4 files — libs/agno/agno/db/mysql/async_mysql.py, libs/agno/agno/db/mysql/mysql.py, libs/agno/agno/db/postgres/async_postgres.py, libs/agno/agno/db/postgres/postgres.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/agent/_storage.py:1363 — `"input_schema" in config and isinstance(config["input_schema"], str)` appears character-identically in 3 files — libs/agno/agno/agent/_storage.py, libs/agno/agno/team/_storage.py, libs/agno/agno/workflow/workflow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/agent/_storage.py:1403 — `"knowledge" in config and isinstance(config["knowledge"], dict)` appears character-identically in 2 files — libs/agno/agno/agent/_storage.py, libs/agno/agno/team/_storage.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:179 — `"media_reference" in aud_data and isinstance(aud_data["media_reference"], dict)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:228 — `"media_reference" in file_data and isinstance(file_data["media_reference"], dict)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:156 — `"media_reference" in img_data and isinstance(img_data["media_reference"], dict)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/models/message.py:205 — `"media_reference" in vid_data and isinstance(vid_data["media_reference"], dict)` appears character-identically in 2 files — libs/agno/agno/models/message.py, libs/agno/agno/utils/media.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/schemas/products.py:11 — `"name" in fields and (not isinstance(fields["name"], str) or not fields["name"].strip())` appears character-identically in 2 files — libs/agno/agno/db/schemas/products.py, libs/agno/agno/db/schemas/projects.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/agent/_storage.py:1377 — `"output_schema" in config and isinstance(config["output_schema"], str)` appears character-identically in 2 files — libs/agno/agno/agent/_storage.py, libs/agno/agno/team/_storage.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/postgres/async_postgres.py:6498 — `"reference" not in fields and candidate["type"] == existing["type"]` appears character-identically in 4 files — libs/agno/agno/db/postgres/async_postgres.py, libs/agno/agno/db/postgres/postgres.py, REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/dynamo/dynamo.py:338 — `"run_data" in payload and isinstance(payload["run_data"], (dict, list))` appears character-identically in 2 files — libs/agno/agno/db/dynamo/dynamo.py, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate cookbook/02_agents/14_advanced/cancel_run.py:39 — `"run_id" not in run_id_container and chunk.run_id` appears character-identically in 4 files — cookbook/02_agents/14_advanced/cancel_run.py, cookbook/02_agents/14_advanced/custom_cancellation_manager.py, cookbook/03_teams/14_run_control/cancel_run.py, cookbook/04_workflows/06_advanced_concepts/run_control/cancel_run.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate libs/agno/agno/db/in_memory/in_memory_db.py:341 — `"session_data" not in session or session["session_data"] is None` appears character-identically in 4 files — libs/agno/agno/db/in_memory/in_memory_db.py, libs/agno/agno/db/json/json_db.py, libs/agno/agno/db/redis/redis.py, libs/agno/agno/db/valkey/valkey.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate cookbook/04_workflows/05_conditional_branching/selector_types.py:49 — `"tech" in topic or "ai" in topic or "software" in topic` appears character-identically in 2 files — cookbook/04_workflows/05_conditional_branching/selector_types.py, cookbook/04_workflows/05_conditional_branching/string_selector.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X4 · Structured logging · Interpolated log message defeats structured logging · ×14
  • Interpolated log message defeats structured logging libs/agno/agno/utils/http.py:199 — `exception` at line 199 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/utils/http.py:205 — `exception` at line 205 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/utils/http.py:242 — `exception` at line 242 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/utils/http.py:248 — `exception` at line 248 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/tools/twilio.py:129 — `exception` at line 129 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/tools/twilio.py:156 — `exception` at line 156 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/os/routers/session/session.py:90 — `warning` at line 90 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/os/routers/metrics/metrics.py:207 — `error` at line 207 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging libs/agno/agno/os/routers/memory/memory.py:781 — `exception` at line 781 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.exception("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.exception("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging cookbook/90_models/clients/http_client_caching.py:50 — `info` at line 50 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging cookbook/90_models/clients/http_client_caching.py:53 — `info` at line 53 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging cookbook/90_models/clients/http_client_caching.py:131 — `info` at line 131 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging cookbook/90_models/clients/http_client_caching.py:137 — `info` at line 137 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging cookbook/90_models/clients/http_client_caching.py:142 — `error` at line 142 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
D16 · Bus Factor · Off-boarding risk · ×5
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 70 significant file(s) lose their only recent owner: libs/agno/agno/fs/toolkit.py, libs/agno/agno/tools/agentos.py, libs/agno/agno/fs/fs.py, libs/agnoctl/agnoctl/commands/connect.py, libs/agno/agno/tools/code/kernel.py, libs/agno/agno/knowledge/page/_commands.py, libs/agno/agno/scheduler/executor.py, libs/agno/agno/tools/knowledge/management.py (+62 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 8 significant file(s) lose their only recent owner: libs/agno/agno/tools/openrouteservice.py, libs/agno/agno/job_queue/config.py, libs/agno/agno/utils/models/_genai_compat.py, cookbook/03_teams/22_metrics/06_loop_team_and_member_metrics.py, cookbook/04_workflows/08_human_in_the_loop/decision_tree/01_decision_tree.py, cookbook/04_workflows/08_human_in_the_loop/decision_tree/02_multi_component_decision_tree.py, cookbook/02_agents/14_advanced/background_streaming_resume.py, cookbook/05_agent_os/background_tasks/durable_continue.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 5 significant file(s) lose their only recent owner: REDACTED, libs/agno/agno/tools/openweather.py, cookbook/91_tools/async_generator_tool_with_pydantic_args.py, cookbook/90_models/google/gemini/gemini_3_8_flash_market_brief.py, cookbook/91_tools/yfinance_tools.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 4 significant file(s) lose their only recent owner: REDACTED, libs/agno/agno/knowledge/reranker/recency.py, cookbook/07_knowledge/02_building_blocks/11_recency_boost.py, cookbook/07_knowledge/09_archive/vector_dbs/chroma_db_batch_size_limit.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 3 significant file(s) lose their only recent owner: libs/agno/agno/os/interfaces/slack/state.py, cookbook/07_knowledge/04_advanced/06_prefix_search.py, libs/agno/agno/os/interfaces/slack/types.py. Pair on, review, or document these before any departure.
X23 · Unguarded diagnostic materialisation · Diagnostic log message is built whether or not it is wanted · ×5
  • Diagnostic log message is built whether or not it is wanted libs/agno_infra/agno/docker/resource/image.py:153 — `debug` at line 153 is called with an argument built by `"…".join(command)` (line 153), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
  • Diagnostic log message is built whether or not it is wanted libs/agno_infra/agno/docker/app/base.py:279 — `debug` at line 279 is called with an argument built by `container_context.model_dump_json(indent = 2)` (line 279), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
  • Diagnostic log message is built whether or not it is wanted libs/agno_infra/agno/docker/app/base.py:293 — `debug` at line 293 is called with an argument built by `"…".join(container_cmd)` (line 293), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
  • Diagnostic log message is built whether or not it is wanted libs/agno_infra/agno/aws/app/base.py:527 — `debug` at line 527 is called with an argument built by `"…".join(container_cmd)` (line 527), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
  • Diagnostic log message is built whether or not it is wanted libs/agno_infra/agno/aws/app/base.py:633 — `debug` at line 633 is called with an argument built by `container_context.model_dump_json(indent = 2)` (line 633), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
X7 · Silent fallback defaults · Silent fallback default in catch · ×5
  • Silent fallback default in catch libs/agno/agno/api/schemas/utils.py:24 — `get_sdk_version` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch libs/agno/agno/db/surrealdb/surrealdb.py:274 — `_get_session_runs_data` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch libs/agno/agno/db/surrealdb/surrealdb.py:366 — `_delete_session_runs` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch libs/agno/agno/tools/google/gmail.py:1273 — `_decode_body_data` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch REDACTED:399 — `count_schema_tokens` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×3
  • Silent fallback default on parse failure libs/agno/agno/team/_messages.py:70 — `_input_kwarg` returns `{}` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure libs/agno/agno/utils/knowledge.py:163 — `get_run_response_kwarg` returns `{}` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure cookbook/02_agents/14_advanced/custom_cancellation_manager.py:52 — `_read_state` returns `{}` when `(json.JSONDecodeError, FileNotFoundError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 34 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (129 single-owned of 1845 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1845 of the 3705 production source files in this repository met that bar). They are anonymized user #6 (2 file(s)), anonymized user #7 (2 file(s)), anonymized user #8 (2 file(s)), anonymized user #9 (2 file(s)), anonymized user #10 (2 file(s)), anonymized user #11 (1 file(s)) (+28 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: libs/agno/agno/media/media.py, cookbook/05_agent_os/04_run_lifecycle/unpack_archives.py, libs/agno/agno/tools/models/aimlapi.py, cookbook/91_tools/models/aimlapi_tools.py, libs/agno/agno/tools/searchapi.py, cookbook/91_tools/searchapi_tools.py, libs/agno/agno/tools/smallest.py, cookbook/91_tools/smallest_tools.py (+31 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 3 of 8 project(s) overshoot their size bounds, lowering Project Cohesion to 2.5/10. The most over is `libs/agno` (426665 LoC, 1861 module-visible types across 221 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 180 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: libs/agno/agno/tools/memory.py, cookbook/04_workflows/06_advanced_concepts/background_execution/websocket_client.py, libs/agno/agno/utils/streamlit.py, cookbook/91_tools/trafilatura_tools.py, libs/agno/agno/filters.py, libs/agno/agno/tools/visualization.py, libs/agno/agno/workflow/remote.py, libs/agno/agno/tools/trafilatura.py (and 172 more) (188 orphaned of 1845 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1845 of the 3705 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 3/9 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `cookbook/01_demo`, `cookbook/08_learning`, `cookbook/91_tools/mcp/mcp_toolbox_demo`, `cookbook/data_labeling/image_search`, `cookbook/gemini_3` and 1 more.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 99232 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
R8 · Dependency Hygiene · Test-only dependency '@openuidev/lang-core' in production deps · ×1
  • Test-only dependency '@openuidev/lang-core' in production deps cookbook/05_agent_os/16_agui/openui/frontend/package.json:17 — Only test files import it (first: cookbook/05_agent_os/16_agui/openui/frontend/src/library.test.ts:1) — move it to devDependencies.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~5.1 `!` null assertions per 1k TypeScript source lines — 1 assertion(s) across the 198 source line(s) of the 4 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: cookbook/05_agent_os/16_agui/openui/frontend/src/main.tsx (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Minor — 104 finding(s)
D12 · Dependency Hygiene · Outdated · ×104
  • Outdated: agno — `agno` is pinned to 2.8.0, but 3.1.10 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.8.0 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: agnoctl — `agnoctl` is pinned to 0.1.3, but 0.2.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.1.3 until the declaration is edited.
  • Outdated: aiohttp — `aiohttp` is pinned to 3.14.3, but 3.14.5 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.14.3 until the declaration is edited.
  • Outdated: annotated-doc — `annotated-doc` is pinned to 0.0.4, but 0.0.5 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.0.4 until the declaration is edited.
  • Outdated: annotated-types — `annotated-types` is pinned to 0.7.0, but 0.8.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.7.0 until the declaration is edited.
  • Outdated: anthropic — `anthropic` is pinned to 0.75.0, but 2.3.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.75.0 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: anyio — `anyio` is pinned to 4.14.2, but 4.15.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 4.14.2 until the declaration is edited.
  • Outdated: build — `build` is pinned to 1.5.0, but 1.6.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.5.0 until the declaration is edited.
  • Outdated: cachetools — `cachetools` is pinned to 5.5.2, but 7.2.5 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 5.5.2 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: certifi — `certifi` is pinned to 2026.7.22, but 2026.10.23 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2026.7.22 until the declaration is edited.
  • Outdated: cffi — `cffi` is pinned to 2.1.0, but 2.1.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.1.0 until the declaration is edited.
  • Outdated: charset-normalizer — `charset-normalizer` is pinned to 3.4.9, but 3.5.2 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.4.9 until the declaration is edited.
  • Outdated: click — `click` is pinned to 8.4.2, but 8.5.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 8.4.2 until the declaration is edited.
  • Outdated: cryptography — `cryptography` is pinned to 49.0.0, but 50.0.2 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 49.0.0 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: curl-cffi — `curl-cffi` is pinned to 0.15.0, but 0.16.3 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.15.0 until the declaration is edited.
  • Outdated: deprecated — `deprecated` is pinned to 1.2.18, but 3.0.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.2.18 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: detect-installer — `detect-installer` is pinned to 0.1.0, but 0.2.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.1.0 until the declaration is edited.
  • Outdated: dnspython — `dnspython` is pinned to 2.8.0, but 2.9.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.8.0 until the declaration is edited.
  • Outdated: durationpy — `durationpy` is pinned to 0.10, but 0.11 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.10 until the declaration is edited.
  • Outdated: fastapi — `fastapi` is pinned to 0.139.2, but 0.162.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.139.2 until the declaration is edited.
  • Outdated: fastapi-cli — `fastapi-cli` is pinned to 0.0.24, but 0.0.32 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.0.24 until the declaration is edited.
  • Outdated: fastapi-cloud-cli — `fastapi-cloud-cli` is pinned to 0.19.0, but 0.26.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.19.0 until the declaration is edited.
  • Outdated: fastar — `fastar` is pinned to 0.11.0, but 0.12.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.11.0 until the declaration is edited.
  • Outdated: filelock — `filelock` is pinned to 3.32.0, but 4.2.4 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.32.0 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: fsspec — `fsspec` is pinned to 2026.6.0, but 2026.9.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2026.6.0 until the declaration is edited.
  • + 79 more in this group — see findings.md.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-2307155ab40147c096c4e77960554710/history.json --exit-code 0 --source .7artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-2307155ab40147c096c4e77960554710/tree.json --exit-code 0 --source .1artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .559artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update59artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .4artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a17285-32e9-78c3-8ae4-f711a23e1872 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md