Skip to content

perf: defer litellm and mcp out of import swarms (2.2s -> 0.37s) - #2090

Open
kyegomez wants to merge 1 commit into
masterfrom
perf/lazy-litellm-mcp
Open

perf: defer litellm and mcp out of import swarms (2.2s -> 0.37s)#2090
kyegomez wants to merge 1 commit into
masterfrom
perf/lazy-litellm-mcp

perf: defer litellm and mcp imports so `import swarms` is 5x faster

75f13d2
Select commit
Loading
Failed to load commit list.
GitHub Advanced Security / Pyre failed Aug 28, 2026 in 10s

12 new alerts including 12 errors

New alerts in code changed by this pull request

  • 12 errors

See annotations below for details.

View all branch alerts.

Annotations

Check failure on line 84 in swarms/agents/context_compressor.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.

Check failure on line 320 in swarms/agents/llm_manager.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.utils.

Check failure on line 520 in swarms/agents/llm_manager.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.exceptions.

Check failure on line 382 in swarms/structs/agent.py

See this annotation in the file changed.

Code scanning / Pyre

Invalid type Error

Invalid type [31]: Expression REASONING_EFFORTS is not a literal value.

Check failure on line 1340 in swarms/structs/agent.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.exceptions.

Check failure on line 2498 in swarms/structs/agent.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.

Check failure on line 2461 in swarms/structs/agent.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.utils.

Check failure on line 101 in swarms/structs/agent_loader.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.

Check failure on line 58 in swarms/structs/agent_router.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.

Check failure on line 196 in swarms/structs/tree_swarm.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.

Check failure on line 35 in swarms/utils/litellm_tokenizer.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.

Check failure on line 41 in swarms/utils/litellm_wrapper.py

See this annotation in the file changed.

Code scanning / Pyre

Undefined import Error

Undefined import [21]: Could not find a module corresponding to import litellm.