Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Bundling Actions Together

Đang mở
#461 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với AppBuilder và GraphBuilder, sau đó theo dõi cách actions, transitions, subgraphs và MappedStates được biểu diễn. So sánh các entry point MultiAction và ActionChain được đề xuất với các builder API hiện có, bao gồm cả phương án thay thế with_subgraph. Công việc được xem là hoàn tất khi dự án có một thiết kế action-graph có thể tái sử dụng và đã được thống nhất, bao gồm mọi ánh xạ lại input/output và hành vi validation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area/core kind/feature priority/medium

Is your feature request related to a problem? Please describe.

@gamarin2 asks:

Hey! While working with class-based actions, I ended up creating state transitions that must logically be split in two separate actions, but where the second one must always be preceded by the first one.

In my case, it's a FormatSummarizer action that formats messages before transitioning to a Summarizer action. These two actions form what I would call an "action bundle": the second one can't be separated from the first one. For now, I have documented that requirement in my class docstring, but it would be nice to have it more strictly enforced. 

I'm sure there are various ways we could achieve this, but perhaps the easiest would be to add a property to the action class where you could specify preceding/following action classes. The AppBuilder would then fail to build if you haven't added the proper transitions.

@mdrideout also suggests:

I would say that I have a very large number of use cases for this, and creating an entire sub-graph for it is painful.

To piggyback on this, I also have a very large number of use cases for running actions with high concurrency, and have been creating sub-graphs simply for the purpose of running a single action for ~10 items. 
but I may be doing this as a workaround because I had a some issues trying to use MappedStates (?) with either pydantic or async.

Describe the solution you'd like
A way to have an action represent a graph.

class MultiAction:
    @abc.abstractmethod
    def get_graph() -> Graph:
        ...

class ActionChain(MultiAction):
    @abc.abstractmethod
    def get_actions() -> List[[Tuple[str, Union[Action, Callable]]]:
        ...

    def get_graph() -> Graph:
        named_actions = self.get_actions()
        action_names = [name for name, _ in named_actions]
        return GraphBuilder().with_actions(**dict(actions)).with_transitions(zip(action_name, action_names[1:]))

Describe alternatives you've considered
Could also have with_subgraph in builder, similar thing. This allows for packaging at the action level for reusability. Might also want the ability to remap inputs/outputs:

def state_maps() -> Tuple[dict, dict]:
    ....

Additional context
Add any other context or screenshots about the feature request here.

Ngôn ngữ chính
Python
Star
2.6k
Fork
203
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/burr

Tất cả issue của apache/burr

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.