strands-swarms 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - name: Install dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ pip install ruff mypy
22
+ pip install -e .
23
+ - name: Lint with ruff
24
+ run: ruff check src/
25
+ - name: Type check with mypy
26
+ run: mypy src/
27
+
28
+ test:
29
+ runs-on: ubuntu-latest
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - name: Set up Python ${{ matrix.python-version }}
37
+ uses: actions/setup-python@v5
38
+ with:
39
+ python-version: ${{ matrix.python-version }}
40
+ - name: Install dependencies
41
+ run: |
42
+ python -m pip install --upgrade pip
43
+ pip install -e ".[dev]"
44
+ - name: Run tests
45
+ run: |
46
+ if [ -d "tests" ]; then
47
+ pytest -v
48
+ else
49
+ echo "No tests directory found, skipping tests"
50
+ fi
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: strands-swarms
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Task-based workflow orchestration for Strands Agents
5
- Project-URL: Homepage, https://github.com/strands-agents/strands-swarms
6
- Project-URL: Issues, https://github.com/strands-agents/strands-swarms/issues
5
+ Project-URL: Homepage, https://github.com/JackXu0/strands-swarms
6
+ Project-URL: Issues, https://github.com/JackXu0/strands-swarms/issues
7
+ Author-email: Zhuocheng Xu <zhuocheng.xu@icloud.com>
7
8
  License: Apache-2.0
8
9
  License-File: LICENSE
9
10
  Classifier: Development Status :: 3 - Alpha
@@ -27,6 +28,10 @@ Description-Content-Type: text/markdown
27
28
 
28
29
  # strands-swarms
29
30
 
31
+ [![CI](https://github.com/JackXu0/strands-swarms/actions/workflows/ci.yml/badge.svg)](https://github.com/JackXu0/strands-swarms/actions/workflows/ci.yml)
32
+ [![PyPI](https://img.shields.io/pypi/v/strands-swarms)](https://pypi.org/project/strands-swarms/)
33
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
34
+
30
35
  **Turn natural language into multi-agent workflows — automatically.**
31
36
 
32
37
  Give `DynamicSwarm` a query, and it automatically plans the workflow, spawns specialized agents, and executes tasks with dependencies. No manual graph configuration or agent wiring required.
@@ -99,7 +104,7 @@ Query: "Research AI trends and write a summary report"
99
104
  ## Installation
100
105
 
101
106
  ```bash
102
- pip install git+https://github.com/JackXu0/strands-swarms.git
107
+ pip install strands-swarms
103
108
  ```
104
109
 
105
110
  ## Quick Start
@@ -1,5 +1,9 @@
1
1
  # strands-swarms
2
2
 
3
+ [![CI](https://github.com/JackXu0/strands-swarms/actions/workflows/ci.yml/badge.svg)](https://github.com/JackXu0/strands-swarms/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/strands-swarms)](https://pypi.org/project/strands-swarms/)
5
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
+
3
7
  **Turn natural language into multi-agent workflows — automatically.**
4
8
 
5
9
  Give `DynamicSwarm` a query, and it automatically plans the workflow, spawns specialized agents, and executes tasks with dependencies. No manual graph configuration or agent wiring required.
@@ -72,7 +76,7 @@ Query: "Research AI trends and write a summary report"
72
76
  ## Installation
73
77
 
74
78
  ```bash
75
- pip install git+https://github.com/JackXu0/strands-swarms.git
79
+ pip install strands-swarms
76
80
  ```
77
81
 
78
82
  ## Quick Start
@@ -4,8 +4,11 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "strands-swarms"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Task-based workflow orchestration for Strands Agents"
9
+ authors = [
10
+ {name = "Zhuocheng Xu", email = "zhuocheng.xu@icloud.com"}
11
+ ]
9
12
  readme = "README.md"
10
13
  requires-python = ">=3.10"
11
14
  license = {text = "Apache-2.0"}
@@ -34,8 +37,8 @@ dev = [
34
37
  ]
35
38
 
36
39
  [project.urls]
37
- Homepage = "https://github.com/strands-agents/strands-swarms"
38
- Issues = "https://github.com/strands-agents/strands-swarms/issues"
40
+ Homepage = "https://github.com/JackXu0/strands-swarms"
41
+ Issues = "https://github.com/JackXu0/strands-swarms/issues"
39
42
 
40
43
  [tool.hatch.build.targets.wheel]
41
44
  packages = ["src/strands_swarms"]
@@ -33,32 +33,32 @@ Example:
33
33
  result = swarm.execute("Research AI trends and summarize")
34
34
  """
35
35
 
36
- from .swarm import DynamicSwarm, DynamicSwarmResult
37
- from .orchestrator import create_orchestrator_agent
36
+ # Re-export strands types for convenience
37
+ from strands.hooks import HookProvider, HookRegistry
38
+ from strands.multiagent.base import Status
39
+
38
40
  from .events import (
39
- # Planning/Orchestration events
40
- SwarmStartedEvent,
41
- PlanningStartedEvent,
42
41
  AgentSpawnedEvent,
43
- TaskCreatedEvent,
44
- PlanningCompletedEvent,
42
+ ExecutionCompletedEvent,
45
43
  # Execution events
46
44
  ExecutionStartedEvent,
47
- TaskStartedEvent,
48
- TaskCompletedEvent,
49
- TaskFailedEvent,
50
- ExecutionCompletedEvent,
51
- SwarmCompletedEvent,
52
- SwarmFailedEvent,
45
+ PlanningCompletedEvent,
46
+ PlanningStartedEvent,
53
47
  # Hook provider
54
48
  PrintingHookProvider,
49
+ SwarmCompletedEvent,
50
+ SwarmFailedEvent,
51
+ # Planning/Orchestration events
52
+ SwarmStartedEvent,
53
+ TaskCompletedEvent,
54
+ TaskCreatedEvent,
55
+ TaskFailedEvent,
56
+ TaskStartedEvent,
55
57
  )
58
+ from .orchestrator import create_orchestrator_agent
59
+ from .swarm import DynamicSwarm, DynamicSwarmResult
56
60
 
57
- # Re-export strands types for convenience
58
- from strands.hooks import HookProvider, HookRegistry
59
- from strands.multiagent.base import Status
60
-
61
- __version__ = "0.1.0"
61
+ __version__ = "0.1.1"
62
62
 
63
63
  __all__ = [
64
64
  # Main API
@@ -9,11 +9,10 @@ from __future__ import annotations
9
9
 
10
10
  import re
11
11
  from dataclasses import dataclass, field
12
- from typing import Any
12
+ from typing import Any, Callable
13
13
 
14
14
  from strands.hooks.registry import BaseHookEvent, HookProvider, HookRegistry
15
15
 
16
-
17
16
  # =============================================================================
18
17
  # Planning Events
19
18
  # =============================================================================
@@ -264,7 +263,7 @@ def _filter_internal_tags(text: str) -> str:
264
263
  return _INTERNAL_TAG_PATTERN.sub('', text)
265
264
 
266
265
 
267
- def create_colored_callback_handler(color: str, agent_name: str):
266
+ def create_colored_callback_handler(color: str, agent_name: str) -> Callable[..., None]:
268
267
  """Create a callback handler that prints agent output with a specific color.
269
268
 
270
269
  This ensures all output from a specific agent (text, reasoning, tool calls)
@@ -14,24 +14,24 @@ from __future__ import annotations
14
14
  import asyncio
15
15
  from dataclasses import dataclass, field
16
16
  from textwrap import dedent
17
- from typing import Any, Callable, TYPE_CHECKING
17
+ from typing import TYPE_CHECKING, Any, Callable
18
18
 
19
19
  from strands import Agent
20
- from strands.multiagent.base import Status, MultiAgentResult
21
- from strands.multiagent.graph import Graph, GraphBuilder, GraphResult
22
20
  from strands.hooks import HookProvider, HookRegistry
21
+ from strands.multiagent.base import MultiAgentResult, Status
22
+ from strands.multiagent.graph import Graph, GraphBuilder, GraphResult
23
23
 
24
24
  from .events import (
25
25
  AGENT_COLORS,
26
- SwarmStartedEvent,
27
- PlanningStartedEvent,
28
- ExecutionStartedEvent,
29
- TaskStartedEvent,
30
- TaskCompletedEvent,
31
26
  ExecutionCompletedEvent,
27
+ ExecutionStartedEvent,
28
+ PlanningStartedEvent,
29
+ PrintingHookProvider,
32
30
  SwarmCompletedEvent,
33
31
  SwarmFailedEvent,
34
- PrintingHookProvider,
32
+ SwarmStartedEvent,
33
+ TaskCompletedEvent,
34
+ TaskStartedEvent,
35
35
  create_colored_callback_handler,
36
36
  )
37
37
 
@@ -301,7 +301,7 @@ def build_swarm(
301
301
  name=definition.name,
302
302
  system_prompt=definition.build_system_prompt(),
303
303
  model=model,
304
- tools=tools if tools else None,
304
+ tools=tools if tools else None, # type: ignore[arg-type]
305
305
  callback_handler=callback_handler,
306
306
  )
307
307
 
@@ -522,7 +522,7 @@ class DynamicSwarm:
522
522
  DynamicSwarmResult containing planning and execution results.
523
523
  """
524
524
  # Import here to avoid circular import
525
- from .orchestrator import set_swarm_config, create_orchestrator_agent
525
+ from .orchestrator import set_swarm_config
526
526
 
527
527
  # Create swarm config for this execution
528
528
  config = SwarmConfig(
@@ -599,6 +599,7 @@ class DynamicSwarm:
599
599
  # Orchestrator Phase 3: Generate Final Response
600
600
  # Uses the SAME orchestrator agent from planning (continued conversation)
601
601
  # =================================================================
602
+ assert planning_result.orchestrator is not None, "Orchestrator should exist after successful planning"
602
603
  final_response = await self._run_completion(
603
604
  query, config, execution_result,
604
605
  orchestrator=planning_result.orchestrator
File without changes