Skip to main content

exoclaw-tools-batch

Map and reduce primitives for agent-controlled ETL pipelines. Run tools against multiple inputs concurrently, then merge results — all without per-item LLM calls.

Tools

BatchTool (map)

Fan out a registered tool across multiple inputs concurrently. Results written to disk to keep agent context clean.

from exoclaw_tools_batch import BatchTool, ReduceTool

batch = BatchTool(concurrency=10)
reduce = ReduceTool()
app = Exoclaw(tools=[batch, reduce, ...])
{
  "tool": "batch",
  "items": [
    {"url": "https://example.com/1"},
    {"url": "https://example.com/2"}
  ],
  "concurrency": 5
}

Returns {output_path: "/tmp/batch_web_fetch_abc.json", count: 2}. Use read_file to inspect results.

ReduceTool (reduce)

Merge multiple batch output files into one.

{
  "dir": "/tmp/batch_llm_call_abc/",
  "key": "results",
  "dedup": "url"
}

Returns {output_path: "/tmp/reduce_xyz.json", count: 150}.

Options:

  • files — explicit list of paths (alternative to dir)
  • key — JSON key to extract from each file (default: "results", empty string for root)
  • dedup — deduplicate by field name
  • output — explicit output path

ETL pipeline example

1. batch(tool="web_fetch", items=[...93 feeds...])
   → /tmp/batch_web_fetch_abc.json

2. batch(tool="llm_call", items=[
     {prompt: "{{ file(path) }}\nExtract interesting URLs", model: "haiku", output: "/tmp/triage/0.json"},
     ...93 items...
   ])
   → 93 parallel cheap LLM calls

3. reduce(dir="/tmp/triage/", dedup="url")
   → /tmp/reduce_xyz.json (merged + deduped)

4. Agent reads merged results, queues to digest

2 batch calls + 1 reduce + 93 cheap model calls. No full agent loops per item.

How it works

  • BatchTool receives the ToolRegistry via duck-typed set_registry() at registration time
  • Runs registry.execute(tool, params) for each item behind an asyncio semaphore
  • Results written to temp files (configurable output_dir)
  • ReduceTool merges JSON files by extracting at a key and concatenating

Requirements

  • exoclaw >= 0.3.0 (with set_registry hook in AgentLoop)

Release files for exoclaw-tools-batch 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for exoclaw-tools-batch 0.2.2
File Size Uploaded
exoclaw_tools_batch-0.2.2.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for exoclaw-tools-batch 0.2.2
File Interpreter ABI Platform
exoclaw_tools_batch-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / exoclaw_tools_batch-0.2.2.tar.gz

Download URL exoclaw_tools_batch-0.2.2.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6eef6d39cf053819942ac288edc9fe1114ffecd72c97024bc79d41b78420a7ba
BLAKE2b-256 checksum
How to use checksums
2e8f3eb56da7dd1dc9c3254eb61b1ecdd08d27a082782d54ff39948f6a7c7ed1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / exoclaw_tools_batch-0.2.2-py3-none-any.whl

Download URL exoclaw_tools_batch-0.2.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24c0c6600480f222392478ca469c2d90ab892c468677f5eff155726cda6e45c5
BLAKE2b-256 checksum
How to use checksums
0a3773ca0b3bdd19903d66104f0a5c194183efff9815f2514525edc7c238fe97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page