Repository Analysis

microsoft/agent-lightning

The absolute trainer to light up AI agents.

18.4 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of microsoft/agent-lightning, a Python project with 17,892 GitHub stars. SynthScan v2.0 examined 16,048 lines of code across 129 source files, recording 214 pattern matches distributed across 12 syntactic categories. The overall adjusted score of 18.4 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

18.4
Adjusted Score
18.4
Raw Score
100%
Time Factor
2026-08-28
Last Push
17.9K
Stars
Python
Language
16.0K
Lines of Code
129
Files
214
Pattern Hits
2026-08-29
Scan Date
0.10
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 1HIGH 12MEDIUM 9LOW 192

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 214 distinct pattern matches across 12 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers92 hits · 98 pts
SeverityFileLineSnippetContext
LOWtests/server/test_endpoints.py73def test_list_rollouts_filters_by_state_in(client: TestClient, auth_headers: dict[str, str]):CODE
LOWtests/server/test_endpoints.py143def test_enqueue_with_client_rollout_id_is_idempotent(client: TestClient, auth_headers: dict[str, str]):CODE
LOWtests/server/test_endpoints.py176def test_re_enqueue_does_not_clobber_a_running_rollout(client: TestClient, auth_headers: dict[str, str]):CODE
LOWtests/server/test_endpoints.py199def test_triplet_events_keep_last_model_request_for_duplicate_prompt(client: TestClient, auth_headers: dict[str, str]):CODE
LOWtests/server/test_endpoints.py248def test_triplet_events_do_not_dedupe_without_valid_prompt_tokens(CODE
LOWtests/server/test_endpoints.py303def test_proxy_completion_endpoint(client: TestClient, auth_headers: dict[str, str], monkeypatch):CODE
LOWtests/server/test_endpoints.py343def test_proxy_error_triplet_preserves_status(client: TestClient, auth_headers: dict[str, str], monkeypatch):CODE
LOWtests/server/test_endpoints.py378def test_proxy_admin_endpoints(client: TestClient, auth_headers: dict[str, str]):CODE
LOWtests/server/test_endpoints.py416def test_terminal_rollouts_cursor_pagination(client: TestClient, auth_headers: dict[str, str]):CODE
LOWtests/controller/test_k8s_reconciler.py11def test_build_job_spec_uses_agentlightning_labels() -> None:CODE
LOWtests/verl/test_rollout_level_advantage.py58def _compute_rollout_level_advantage(CODE
LOWtests/verl/test_rollout_level_advantage.py74def test_rollout_level_advantage_collapses_rollouts_and_broadcasts_triplets() -> None:CODE
LOWtests/verl/test_rollout_level_advantage.py117def test_rollout_level_advantage_requires_rollout_ids() -> None:CODE
LOWtests/verl/test_rollout_level_advantage.py125def test_rollout_level_advantage_rejects_inconsistent_rollout_rewards() -> None:CODE
LOWtests/verl/test_rollout_level_advantage.py132def test_rollout_level_advantage_rejects_non_scalar_token_advantages() -> None:CODE
LOWtests/verl/test_agl_rollout_manager.py55def test_build_completed_rollout_skips_error_and_empty_model_requests() -> None:CODE
LOWtests/verl/test_agl_rollout_manager.py148def _triplet_model_request_event(prompt_token_ids: object, response_token_ids: list[int]) -> Event:CODE
LOWtests/verl/test_agl_rollout_manager.py163def test_extract_image_urls_from_messages() -> None:CODE
LOWtests/verl/test_agl_rollout_manager.py187def test_build_completed_rollout_aligns_image_urls_with_triplets() -> None:CODE
LOWtests/verl/test_agl_rollout_manager.py225def test_build_completed_rollout_aligns_images_without_valid_prompt_token_ids(prompt_token_ids: object) -> None:CODE
LOWtests/verl/test_agl_rollout_manager.py252def test_aligned_image_urls_count_mismatch_returns_none(capsys: pytest.CaptureFixture[str]) -> None:CODE
LOWtests/verl/test_agl_rollout_manager.py259def test_aligned_image_urls_text_only_rollout_returns_none_without_warning(CODE
LOWtests/verl/test_per_rollout_loss.py36def test_normalize_advantages_by_rollout() -> None:CODE
LOWtests/verl/test_per_rollout_loss.py60def test_policy_loss_matches_masked_sum() -> None:CODE
LOWtests/verl/test_per_rollout_loss.py77def test_normalize_advantages_validates_inputs() -> None:CODE
LOWtests/verl/test_rollout_adapter.py144def test_trajectory_prefix_mismatch_uploads_trace_merge_table_to_wandb(CODE
LOWtests/verl/test_rollout_adapter.py271def test_validation_uploads_all_compact_rollout_trajectories_to_wandb_zip(CODE
LOWtests/verl/test_rollout_adapter.py420def test_transition_image_rows_attach_multi_modal_inputs_and_mrope_position_ids(CODE
LOWtests/verl/test_rollout_adapter.py447def test_text_only_rows_keep_original_behavior_with_processor() -> None:CODE
LOWtests/verl/test_rollout_adapter.py464def test_trajectory_level_with_image_triplets_raises() -> None:CODE
LOWtests/verl/test_rollout_adapter.py480def test_truncated_image_prompt_falls_back_to_text_only(CODE
LOWtests/verl/test_rollout_adapter.py514def test_processor_without_vision_output_falls_back_to_text_only(CODE
LOWtests/verl/test_rollout_adapter.py528def test_is_mrope_processor_detection() -> None:CODE
LOWtests/verl/test_rollout_adapter.py538def test_load_pil_image_decodes_data_url() -> None:CODE
LOWtests/verl/test_rollout_adapter.py552def test_load_pil_image_fetches_remote_url_by_default(monkeypatch: pytest.MonkeyPatch) -> None:CODE
LOWtests/examples/test_swe_smith_images.py65def test_openai_image_name_matches_job_template_convention() -> None:CODE
LOWtests/examples/test_swe_smith_images.py69def test_openai_image_name_rejects_already_tagged_sources() -> None:CODE
LOWtests/examples/test_swe_smith_images.py74def test_prepare_one_skips_when_openai_image_already_loaded() -> None:CODE
LOWtests/examples/test_swe_smith_images.py89def test_prepare_one_builds_openai_layer_from_local_base_without_pulling() -> None:CODE
LOWtests/examples/test_swe_smith_images.py109def test_prepare_one_retargs_existing_agl_openai_alias_without_build_or_pull() -> None:CODE
LOWtests/examples/test_swe_smith_images.py125def test_prepare_one_pulls_missing_base_only_when_allowed() -> None:CODE
LOWtests/examples/test_swe_smith_images.py140def test_prepare_one_can_require_preloaded_base_image() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py321def test_length_penalty_only_applies_to_solved() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py328def test_length_penalty_skips_validation() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py337def test_length_penalty_solved_within_budget_keeps_full_reward() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py343def test_length_penalty_solved_ramps_to_cap() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py353def test_length_penalty_guards_degenerate_span() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py371def test_prompt_length_penalty_only_applies_to_solved() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py377def test_prompt_length_penalty_skips_validation() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py383def test_prompt_length_penalty_below_soft_start_keeps_reward() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py389def test_prompt_length_penalty_ramps_linearly() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py397def test_prompt_length_penalty_saturates_at_hard_cap() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py403def test_prompt_length_penalty_stacks_with_turn_penalty() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py94def test_generic_error_burns_turn_and_continues() -> None:CODE
LOWtests/examples/test_swe_smith_agent.py108def test_git_retry_removes_stale_index_lock_after_nonzero(monkeypatch, tmp_path) -> None:CODE
LOWtests/examples/test_swe_smith_agent.py140def test_git_retry_removes_stale_index_lock_after_timeout(monkeypatch, tmp_path) -> None:CODE
LOWtests/examples/test_swe_smith_agent.py167def test_git_retry_sleeps_before_each_checkout(monkeypatch, tmp_path) -> None:CODE
LOWtests/examples/test_swe_smith_agent.py188def test_checkout_bug_commit_uses_swesmith_official_checkout(monkeypatch) -> None:CODE
LOWtests/examples/test_swe_smith_agent.py202def test_forbidden_action_blocks_git_usage(monkeypatch) -> None:CODE
LOWtests/examples/test_swe_smith_agent.py218def test_forbidden_action_blocks_git_metadata_access(monkeypatch) -> None:CODE
32 more matches not shown…
Cross-File Repetition9 hits · 45 pts
SeverityFileLineSnippetContext
HIGHexamples/calc_x/train_calc_agent.py0load gsm8k datasets, build config, and launch verl training via agent lightning.STRING
HIGHexamples/search_r1/train_search_r1_agent.py0load gsm8k datasets, build config, and launch verl training via agent lightning.STRING
HIGHexamples/llm-in-sandbox/train_llm_in_sandbox.py0load gsm8k datasets, build config, and launch verl training via agent lightning.STRING
HIGHexamples/gsm8k/train_gsm8k_agent.py0load gsm8k datasets, build config, and launch verl training via agent lightning.STRING
HIGHexamples/search_r1/train_search_r1_agent.py0build the full omegaconf config by merging base + overrides.STRING
HIGHexamples/science_world/train_sw_agent.py0build the full omegaconf config by merging base + overrides.STRING
HIGHexamples/gsm8k/train_gsm8k_agent.py0build the full omegaconf config by merging base + overrides.STRING
HIGHexamples/multimodal_qa/train_multimodal_qa.py0build the full omegaconf config by merging base + overrides.STRING
HIGHexamples/llm-in-sandbox/train_llm_in_sandbox.py0build the full omegaconf config by merging base + overrides.STRING
Unused Imports45 hits · 44 pts
SeverityFileLineSnippetContext
LOWtests/server/conftest.py5CODE
LOWtests/server/test_endpoints.py5CODE
LOWtests/verl/test_rollout_level_advantage.py3CODE
LOWtests/verl/test_agl_rollout_manager.py5CODE
LOWtests/verl/test_per_rollout_loss.py3CODE
LOWtests/verl/test_rollout_adapter.py3CODE
LOWtests/examples/test_swe_smith_images.py3CODE
LOWtests/examples/test_swe_smith_agent.py12CODE
LOWdocs/macros/source_links.py3CODE
LOWexamples/calc_x/calc_agent.py8CODE
LOWexamples/swe_smith/pull_images.py12CODE
LOWexamples/swe_smith/train_smith_agent.py3CODE
LOWexamples/swe_smith/train_smith_agent_megatron.py5CODE
LOWexamples/swe_smith/agents/smith_agent.py5CODE
LOWexamples/search_r1/retrieval_server.py3CODE
LOWexamples/search_r1/train_search_r1_agent.py3CODE
LOWexamples/search_r1/agents/qa_em.py17CODE
LOWexamples/search_r1/agents/search_r1_agent.py3CODE
LOWexamples/science_world/train_sw_agent.py22CODE
LOWexamples/science_world/agents/sw_agent.py28CODE
LOWexamples/gsm8k/gsm8k_agent.py8CODE
LOWexamples/multimodal_qa/multimodal_qa_agent.py8CODE
LOWexamples/llm-in-sandbox/train_llm_in_sandbox.py6CODE
LOWexamples/llm-in-sandbox/agents/runner.py6CODE
LOWscripts/check_headers.py5CODE
LOWagentlightning/hooks.py5CODE
LOWagentlightning/client.py5CODE
LOWagentlightning/schemas.py5CODE
LOWagentlightning/server/store.py9CODE
LOWagentlightning/server/proxy.py5CODE
LOWagentlightning/server/app.py5CODE
LOWagentlightning/server/__main__.py5CODE
LOWagentlightning/server/routes/models.py5CODE
LOWagentlightning/server/routes/events.py5CODE
LOWagentlightning/server/routes/proxy.py5CODE
LOWagentlightning/server/routes/rollouts.py5CODE
LOWagentlightning/controller/k8s_reconciler.py12CODE
LOWagentlightning/controller/local_reconciler.py5CODE
LOWagentlightning/controller/__main__.py5CODE
LOWagentlightning/verl/agl_rollout_manager.py5CODE
LOWagentlightning/verl/rollout_adapter.py5CODE
LOWagentlightning/verl/per_rollout_loss.py5CODE
LOWagentlightning/verl/entrypoint.py13CODE
LOWagentlightning/verl/rollout_level_advantage.py5CODE
LOWagentlightning/verl/trainer.py5CODE
Excessive Try-Catch Wrapping31 hits · 32 pts
SeverityFileLineSnippetContext
LOWexamples/calc_x/eval_utils.py66 except Exception:CODE
LOWexamples/swe_smith/pull_images.py106 except Exception:CODE
LOWexamples/swe_smith/pull_images.py184 except Exception as exc:CODE
LOWexamples/swe_smith/agents/smith_agent.py350 except Exception as exc:CODE
LOWexamples/swe_smith/agents/smith_agent.py567 except Exception as exc:CODE
LOWexamples/swe_smith/agents/smith_agent.py834 except Exception as exc:CODE
MEDIUMexamples/swe_smith/agents/smith_agent.py557def capture_patch() -> str:CODE
LOWexamples/science_world/agents/sw_agent.py224 except Exception as e:CODE
LOWexamples/llm-in-sandbox/agents/runner.py127 except Exception as exc:CODE
LOWagentlightning/client.py58 except Exception as exc:CODE
LOWagentlightning/client.py76 except Exception as exc:CODE
LOWagentlightning/controller/k8s_reconciler.py152 except Exception:CODE
LOWagentlightning/controller/k8s_reconciler.py266 except Exception as exc:CODE
LOWagentlightning/controller/k8s_reconciler.py296 except Exception:CODE
LOWagentlightning/controller/k8s_reconciler.py360 except Exception as exc:CODE
LOWagentlightning/controller/local_reconciler.py44 except Exception:CODE
LOWagentlightning/controller/local_reconciler.py121 except Exception:CODE
LOWagentlightning/controller/local_reconciler.py235 except Exception as e:CODE
LOWagentlightning/controller/local_reconciler.py253 except Exception:CODE
LOWagentlightning/controller/local_reconciler.py281 except Exception as e:CODE
LOWagentlightning/verl/agl_rollout_manager.py303 except Exception as exc:CODE
LOWagentlightning/verl/agl_rollout_manager.py317 except Exception as exc:CODE
LOWagentlightning/verl/agl_rollout_manager.py433 except Exception:CODE
LOWagentlightning/verl/agl_rollout_manager.py444 except Exception:CODE
LOWagentlightning/verl/rollout_adapter.py56 except Exception:CODE
LOWagentlightning/verl/rollout_adapter.py127 except Exception as exc:CODE
LOWagentlightning/verl/rollout_adapter.py162 except Exception as exc:CODE
LOWagentlightning/verl/rollout_adapter.py659 except Exception as exc:CODE
LOWagentlightning/verl/rollout_adapter.py686 except Exception as exc:CODE
LOWagentlightning/verl/rollout_adapter.py700 except Exception:CODE
LOWagentlightning/verl/entrypoint.py134 except Exception as exc:CODE
Cross-Language Confusion3 hits · 15 pts
SeverityFileLineSnippetContext
HIGHtests/examples/test_swe_smith_agent.py207 "cd /testbed && git checkout 614b134 -- pkg/x.py",CODE
HIGHexamples/swe_smith/agents/smith_agent.py93commands connected with && or ||).CODE
HIGHexamples/swe_smith/agents/smith_agent.py151- That block MUST contain EXACTLY ONE command (or several joined with && or ||).CODE
Deep Nesting15 hits · 15 pts
SeverityFileLineSnippetContext
LOWexamples/swe_smith/pull_images.py149CODE
LOWexamples/swe_smith/agents/smith_agent.py715CODE
LOWexamples/search_r1/retrieval_server.py124CODE
LOWagentlightning/server/routes/events.py100CODE
LOWagentlightning/controller/k8s_reconciler.py161CODE
LOWagentlightning/controller/k8s_reconciler.py300CODE
LOWagentlightning/controller/local_reconciler.py129CODE
LOWagentlightning/verl/agl_rollout_manager.py138CODE
LOWagentlightning/verl/agl_rollout_manager.py166CODE
LOWagentlightning/verl/agl_rollout_manager.py517CODE
LOWagentlightning/verl/agl_rollout_manager.py573CODE
LOWagentlightning/verl/rollout_adapter.py368CODE
LOWagentlightning/verl/trainer.py286CODE
LOWagentlightning/verl/trainer.py645CODE
LOWagentlightning/verl/trainer.py298CODE
Decorative Section Separators4 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMtests/verl/test_rollout_adapter.py327# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/verl/test_rollout_adapter.py329# ---------------------------------------------------------------------------COMMENT
MEDIUMagentlightning/verl/rollout_adapter.py188# ---------------------------------------------------------------------------COMMENT
MEDIUMagentlightning/verl/rollout_adapter.py195# ---------------------------------------------------------------------------COMMENT
AI Slop Vocabulary4 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMtests/examples/test_swe_smith_agent.py245 # Network/package-install/test-harness-tamper routes are reward-hackingCOMMENT
MEDIUMtests/examples/test_swe_smith_agent.py294 # .git moved out of the worktree and harness now targets it explicitly.COMMENT
MEDIUMexamples/swe_smith/agents/smith_agent.py28# harness still reaches it via --git-dir/--work-tree. See also _forbidden_action.COMMENT
MEDIUMexamples/swe_smith/agents/smith_agent.py71# Writing test-harness/config files (conftest, .pth, sitecustomize) can forceCOMMENT
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippetContext
CRITICALagentlightning/verl/trainer.py616 loss_mode = self.config.actor_rollout_ref.actor.policy_loss.get("loss_mode", "vanilla")CODE
Modern Structural Boilerplate5 hits · 5 pts
SeverityFileLineSnippetContext
LOWexamples/science_world/agents/sw_agent.py75def _setup_logging() -> None:CODE
LOWagentlightning/verl/agl_rollout_manager.py659__all__ = [CODE
LOWagentlightning/verl/rollout_adapter.py838__all__ = ["RolloutAdapter"]CODE
LOWagentlightning/verl/entrypoint.py28__all__ = [CODE
LOWagentlightning/verl/dataset.py12__all__ = [CODE
Structural Annotation Overuse3 hits · 4 pts
SeverityFileLineSnippetContext
LOWdocs/00-installation.md7#### Step 1: UV SyncCOMMENT
LOWdocs/00-installation.md18#### Step 2: Install `verl` and FlashAttentionCOMMENT
LOWdocs/00-installation.md35#### Step 3: W&B LoginCOMMENT
Over-Commented Block2 hits · 2 pts
SeverityFileLineSnippetContext
LOWexamples/swe_smith/requirements.txt1# Extra dependencies for the swe_smith example, beyond the Agent Lightning rootCOMMENT
LOWexamples/search_r1/agents/qa_em.py1# Copyright (c) Microsoft. All rights reserved.COMMENT