AGENT SKILL

core-abstraction

Use PocketFlow's core graph runtime: Node, Flow, BatchNode, BatchFlow, async variants, action transitions, retries, fallback, and shared-store semantics.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
core-abstraction
license
MIT
metadata
{ "disco-role": "operating" }
description
Use PocketFlow's core graph runtime: Node, Flow, BatchNode, BatchFlow, async variants, action transitions, retries, fallback, and shared-store semantics.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

PocketFlow Core Abstraction

Use this sub-skill when the user asks about PocketFlow's public runtime semantics, a failing flow, or how to express a graph in terms of nodes, actions, shared state, params, batch behavior, or async orchestration.

What this sub-skill covers

  • BaseNode, Node, BatchNode, Flow, BatchFlow.
  • AsyncNode, AsyncBatchNode, AsyncParallelBatchNode, AsyncFlow, AsyncBatchFlow, AsyncParallelBatchFlow.
  • The prep -> exec -> post lifecycle.
  • >> default transitions and - "action" >> named transitions.
  • Retry/fallback behavior and cur_retry.
  • Flow composition, nested flows, and flow-as-node routing.
  • Shared store vs params.
  • Batch and parallel semantics, including nested batches.

What to read first

  • API reference for signatures and behavior.
  • Workflows for linear, branching, nested, batch, async, and parallel recipes.
  • Troubleshooting for error messages, missing transitions, retry/fallback issues, and async misuse.
  • Core smoke helper for a deterministic local sanity check.

Typical user requests

  • "Why is my flow ending early?"
  • "How do I branch on an action string?"
  • "Why does BatchFlow not see my data?"
  • "Why is my async node not running?"
  • "How do I make a flow inside another flow?"
  • "How do retries and fallbacks work?"

Route map

Need Read
Method signatures, defaults, and runtime rules references/api-reference.md
Linear, branching, nested, batch, async, or parallel recipes references/workflows.md
Warning messages, failure modes, and repair steps references/troubleshooting.md
Fast local runtime check scripts/core_flow_smoke.py

Core mental model

Node

A node is a tiny unit of work with optional prep, exec, and post methods.

  • prep(shared) reads from the shared store and prepares input.
  • exec(prep_res) performs the computation and may be retried.
  • post(shared, prep_res, exec_res) writes results and returns the next action string.

Flow

A flow orchestrates node transitions.

  • Use node_a >> node_b for default transitions.
  • Use node_a - "search" >> node_b for named transitions.
  • The return value from post() determines which successor runs next.

Batch

BatchFlow repeats a flow with parameter dictionaries.

  • BatchFlow.prep(shared) returns a list of dicts.
  • Each dict becomes self.params for the child flow.
  • Child nodes read params from self.params, not from the shared store.

Async and parallel

  • AsyncNode and async flow types use run_async() / prep_async() / exec_async() / post_async().
  • AsyncParallelBatchNode and AsyncParallelBatchFlow are for independent I/O-bound work.
  • Do not treat them as CPU-parallel primitives.

Common success signals

  • A branch flow runs the expected successor and stores the expected shared value.
  • A retry node uses fallback after the final attempt and keeps the flow alive.
  • A BatchNode returns a list of results in post() and the reduce node consumes that list.
  • An async node completes under AsyncFlow.run_async() and mixed sync/async nodes can coexist in one async flow.

Boundaries

  • Do not use this sub-skill to design provider wrappers, LLM prompts, search, vector databases, or UI/service integrations. Those belong to utilities or design-patterns.
  • Do not rely on original repository paths or cookbook files at runtime.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351