AGENT SKILL

pocketflow

Use PocketFlow, a tiny Python graph framework for LLM applications, agents, workflows, RAG, batch processing, async orchestration, and supporting utilities.

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

01 前言 Front Matter

name
pocketflow
license
MIT
metadata
{ "disco-role": "operating" }
description
Use PocketFlow, a tiny Python graph framework for LLM applications, agents, workflows, RAG, batch processing, async orchestration, and supporting utilities.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

PocketFlow Repo Skill

Use this skill when a task asks to build, debug, review, or explain a PocketFlow application or to translate an LLM-system design into PocketFlow nodes and flows. PocketFlow is intentionally minimal: the installed package exposes a compact graph runtime with no built-in LLM provider, vector database, search, UI, audio, or tracing integration. Those integrations live in user utilities that PocketFlow nodes call.

Fast recognition

Read this skill when the user mentions any of these signals:

  • pocketflow, Pocket Flow, or a 100-line LLM framework.
  • Node, Flow, BatchNode, BatchFlow, AsyncNode, AsyncFlow, AsyncParallelBatchNode, or AsyncParallelBatchFlow in a graph-orchestration context.
  • A Python LLM app with prep -> exec -> post, a shared dictionary, action strings, graph transitions, or node - "action" >> other_node syntax.
  • Building lightweight agents, RAG, map-reduce, structured-output, streaming, FastAPI background jobs, voice/chat workflows, or coding-agent loops without a large framework.

Minimal install and import check

pip install pocketflow
python - <<'PY'
from pocketflow import Node, Flow
class Start(Node):
    def prep(self, shared):
        shared["seen"] = True
start = Start()
Flow(start=start).run({})
print("pocketflow import ok")
PY

For development from source, an editable install is also valid. The public package version captured for this skill is 0.0.3; see repo provenance for the source snapshot.

Route by task

If the task is about... Read
Public runtime classes, prep/exec/post, transitions, retries, fallback, nested flows, sync/async, batch/parallel behavior, or unit-test-like API debugging core-abstraction
Designing an LLM app architecture, deciding between workflow/agent/RAG/map-reduce/structured-output/multi-agent patterns, or using cookbook-style recipes design-patterns
Implementing provider wrappers, search/embedding/vector/TTS/database utilities, graph visualization, logging/tracing, chunking, streaming, or external dependency safety utilities
Cross-cutting install/import/provider/config mistakes before choosing a sub-skill troubleshooting
Router placement, source snapshot, or staleness checks repo provenance and routing metadata

PocketFlow mental model

  1. A node has three optional phases. prep(shared) reads and prepares data, exec(prep_res) performs compute and is the only phase retried, and post(shared, prep_res, exec_res) writes results and returns the next action.
  2. A flow follows action strings. a >> b is the default transition. a - "search" >> b is a named transition. If post() returns None, PocketFlow looks for the default successor.
  3. The shared store is the durable data contract. Most task state should be in a user-designed dictionary or persistence layer. Nodes communicate by reading/writing it.
  4. Params are per-run identifiers. BatchFlow.prep() returns parameter dictionaries; child nodes read them from self.params. Do not use params as mutable shared state.
  5. PocketFlow is not an integration framework. LLM calls, embeddings, vector search, DB queries, speech, UI, and observability are ordinary utility functions invoked by nodes.
  6. Start simple. For a new LLM system, write a short design document first, then implement utilities, shared-store schema, nodes, and flows.

Common safe checks

Boundaries and caveats

  • Do not claim PocketFlow automatically manages prompts, memory, tools, provider retries, callbacks, vector indexes, web servers, tracing, or credentials. Implement those explicitly as utilities and shared-store fields.
  • Avoid writing giant exec() methods that read/write global state; put input selection in prep() and result persistence in post().
  • Do not run credentialed cookbook-style examples unless the user has provided required keys and approved network or service side effects.
  • AsyncParallelBatchNode and AsyncParallelBatchFlow overlap independent async work; they are not CPU-parallel execution engines.
  • If a task is primarily about maintaining this repository source code rather than using PocketFlow as a package, also apply normal Python repository maintenance practices.

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