Skip to main content

Batch/map tool for running tools against multiple inputs concurrently

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exoclaw_tools_batch-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

exoclaw_tools_batch-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file exoclaw_tools_batch-0.1.0.tar.gz.

File metadata

  • Download URL: exoclaw_tools_batch-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using 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":null}

File hashes

Hashes for exoclaw_tools_batch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71e5f96f60133b0f824b710035d6b5484e9454f1f6a27f574fa388d6d55c1541
MD5 3970b7a6d8cc3d85532c57ed07c9466a
BLAKE2b-256 db13c4493d700c4ee3dba7292dcd7342a29b8200cc3521b48434f05cc579b5ec

See more details on using hashes here.

File details

Details for the file exoclaw_tools_batch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: exoclaw_tools_batch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using 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":null}

File hashes

Hashes for exoclaw_tools_batch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20d79fe9f12ad439c8d2376dbee20cbe88fcb76e7e062d368bc540e1a7bda32e
MD5 0eb95a878cefa8bf01e8a1e1b9da27ce
BLAKE2b-256 35ca9fad6724fd6adb9a51ca4b487e72976da8865fedeb1dc0a0ca472f46a0a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page