📅 Goal Decomposition

SLM Task Planner

Autonomous goal decomposition system. Breaks complex tasks into prioritized action items and assigns them to specialized local sub-agents.

🚀 Overview & Capabilities

Autonomous goal decomposition system. Breaks complex tasks into prioritized action items and assigns them to specialized local sub-agents.

Key Features

  • Goal decomposition and sub-task scheduling
  • Dependency mapping for parallel execution branches
  • Runtime execution tracker with dynamic adjustment
  • Fallback handler to revise tasks if a sub-agent fails

💻 Installation

Install the local CPU-optimized package using pip:

Terminal
# Install local CPU-optimized package
pip install slm-task-planner

🐙 Checkout from GitHub

Clone only this agent's folder from the monorepo using Git sparse-checkout — no need to download the full repository:

Option 1 — Sparse Checkout (Recommended)

Terminal — Git Sparse Checkout
# 1. Create and enter a new directory
$ mkdir slm_task_planner && cd slm_task_planner

# 2. Initialise empty git repo and add remote
$ git init
$ git remote add origin https://github.com/t00114218-stack/SLMAgents.git

# 3. Enable sparse-checkout and set target folder
$ git sparse-checkout init --cone
$ git sparse-checkout set slm_task_planner

# 4. Pull only that agent's source
$ git pull origin main

Option 2 — Full Repository Clone

Terminal — Full Clone
$ git clone https://github.com/t00114218-stack/SLMAgents.git
$ cd SLMAgents/slm_task_planner

💡 Tip: After checkout, install the package locally with pip install -e ./slm_task_planner to run in editable mode without publishing to PyPI.

⚙️ Configuration API

Constructor Parameters

Instantiate SLMTaskPlanner with performance options:

ParameterType / DefaultDescription
model_pathstr | NoneExplicit path to ONNX model weights. If omitted, downloads standard checkpoints.
cache_dirstr | NoneDirectory to store model weights offline. Defaults to ~/.cache/slm-task-planner/. Also settable via SLM_TASK_PLANNER_CACHE_DIR.
n_threadsint | 4CPU thread count for ONNX inference. Optimize for CPU core count. Also settable via SLM_TASK_PLANNER_N_THREADS.

Methods

Method SignatureReturn TypeDescription
build_plan(goal_text, system_prompt=None, user_input=None)dictDecomposes a high-level goal query string into a sequence of executable dependency steps.

Method Parameters (Execution Customization)

All main execution methods accept optional system routing parameters:

ParameterType / DefaultDescription
system_promptstr | NoneOptional custom system prompt instruction to override the default system template response parameters.
user_inputstr | NoneOptional additional user-supplied target text variables or contextual keys.

Quick Start

from slm_task_planner import SLMTaskPlanner

planner = SLMTaskPlanner()
plan = planner.build_plan(
    "Extract stats 1 from PDF",
    system_prompt="Limit plan depth to 3 steps maximum",
    user_input="Target PDF name: budget.pdf"
)
print(plan)

Environment Variables

Configure agent parameters globally using environment values:

Environment VariableDefaultPurpose
SLM_TASK_PLANNER_N_THREADS4Sets CPU inference execution threads.
SLM_TASK_PLANNER_CACHE_DIR~/.cache/slm-task-planner/Default directory to store downloaded ONNX weights.

CPU Performance Tuning

To run the SLMTaskPlanner engine efficiently on CPU under 1.5 GB memory footprint:

  • Match Threads to Core Count: Set n_threads or SLM_TASK_PLANNER_N_THREADS to match the physical CPU core count.
  • Sequential Processing: Avoid concurrent processing when batch files are large.
  • Garbage Collection: Clear variables and run gc.collect() to release model RAM blocks after execution.

Verified Input & Output Logs

Diagnostic execution console response running locally on CPU:

→ INPUT (Goal):
"Extract stats 1 from PDF"

← OUTPUT (Plan):
{
  'goal': 'Extract stats 1 from PDF',
  'tasks': [{'step': 1, 'task': 'Extract layout & tabular data from document', 'assigned_agent': 'SLMPDFChat / SLMDocumentParser'}],
  'total_steps': 1
}