Incremental engine for long horizon agents π Star if you like it!
Rust agentic-data-frameworkaiai-agentschange-data-capturecodebase-intelligencecontext-engineeringdata-engineeringdata-indexingdata-processingetlhelp-wantedindexingknowledge-graphllmlong-horizon-agentpythonragreal-timerustsemantic-search
docs(skill): use as_async for batching and runners (#2636)
hatemadi15898f35f2e7ad
diff --git a/skills/cocoindex/SKILL.md b/skills/cocoindex/SKILL.mdindex 7c43997e..7c56b1c7 100644--- a/skills/cocoindex/SKILL.md+++ b/skills/cocoindex/SKILL.md@@ -92,11 +92,31 @@ async def expensive_operation(data: str) -> Result:return await expensive_transform(data)```-**Key parameters:**+**Key parameters for `@coco.fn`:**- `memo=True` -- Enable memoization (skip if inputs/code unchanged)- `version=1` -- Explicit version bump to force re-execution-- `batching=True` -- Auto-batch concurrent calls (async only)-- `runner=coco.GPU` -- Serialize GPU-bound execution++For batching or a runner, use `@coco.fn.as_async`, even when the underlying+function is already `async def`. Plain `@coco.fn` rejects `batching=True`,+`max_batch_size`, and `runner` with `ValueError`.++- `@coco.fn.as_async(batching=True, max_batch_size=32)` -- Auto-batch concurrent calls+- `@coco.fn.as_async(runner=coco.GPU)` -- Run through the GPU runner++A batched body receives a list and returns a list of the same length; callers+pass one item and await one result:++```python[email protected]_async(batching=True, max_batch_size=32)+async def uppercase(texts: list[str]) -> list[str]:+ return [text.upper() for text in texts]++result = await uppercase("hello") # "HELLO", not a list+```++`@coco.fn.as_async` accepts both `def` and `async def` bodies. See the+[function guide](https://cocoindex.io/docs/programming_guide/function/#batching)+for batch concurrency limits and runner configuration.### 3. Processing Componentsdiff --git a/skills/cocoindex/references/api_reference.md b/skills/cocoindex/references/api_reference.mdindex 190a03e1..aae946cb 100644--- a/skills/cocoindex/references/api_reference.md+++ b/skills/cocoindex/references/api_reference.md@@ -28,13 +28,19 @@ async def expensive_fn(data: str) -> Result: ...def batch_embed(texts: list[str]) -> list[NDArray]: ...```-**Parameters:**+**Parameters shared by `@coco.fn` and `@coco.fn.as_async`:**- `memo: bool = False` -- Enable memoization (skip if inputs/code unchanged)- `version: int | None = None` -- Explicit version bump to force re-execution- `logic_tracking: "full" | "self" | None = "full"` -- How code changes are tracked-- `batching: bool = False` -- Auto-batch concurrent calls (async only)-- `max_batch_size: int | None = None` -- Max batch size-- `runner: Runner | None = None` -- e.g. `coco.GPU` for serialized GPU execution++**Options for `@coco.fn.as_async` only:**+- `batching: bool = False` -- Auto-batch concurrent calls+- `max_batch_size: int | None = None` -- Max batch size (with batching)+- `runner: Runner | None = None` -- e.g. `coco.GPU` for GPU-bound execution++These options require `@coco.fn.as_async` even on an `async def` body.+Plain `@coco.fn` rejects them with `ValueError`. With batching, the body accepts+and returns lists, but each caller passes one item and awaits one result.---