Build autonomous AI workflows from Ollama models, inference.sh, Python scripts, and OpenClaw cron.
| Tool | What it does | Location |
|---|---|---|
| Ollama | Local GGUF model inference | /opt/homebrew/bin/ollama |
| inference.sh | Cloud AI CLI with third-party models | curl -fsSL https://cli.inference.sh | sh |
| openclaw cron | Schedule agent tasks | openclaw cron add |
| Python scripts | Custom pipelines (blog, SEO, Repo Roulette) | ~/.openclaw/workspace/scripts/ |
| AgentMail SDK | Email in/out for the Sol AI inbox | agentmail-email skill |
For a task that just needs a script to run on a schedule.
openclaw cron add \
--name "Sol — My Task" \
--schedule "0 9 * * *" \
--session-target isolated \
-- python3 /path/to/script.py
For tasks that need logic, state, and conditional output.
import pathlib, json
# State file for idempotency
STATE = pathlib.Path("/Users/amre/.openclaw/workspace/scripts/my-task/state.json")
def main():
state = json.loads(STATE.read_text()) if STATE.exists() else {"step": 0}
if state["step"] == 0:
# Step 1: do something
state["step"] = 1
elif state["step"] == 1:
# Step 2: do next thing
state["step"] = 0 # reset for next run
STATE.write_text(json.dumps(state))
# Step 1: LLM decides
result = subprocess.run(
["ollama", "run", "qwen3:14b"],
input="What category does this fall under?\n" + text,
capture_output=True, text=True, timeout=120
)
# Step 2: Another model acts on decision
if "category_a" in result.stdout.lower():
subprocess.run(["python3", "handle_a.py"], capture_output=True)
elif "category_b" in result.stdout.lower():
subprocess.run(["python3", "handle_b.py"], capture_output=True)
Implement: Write the script, test it manually first.
Test in isolation:
cd /Users/amre/.openclaw/workspace
python3 /path/to/script.py
echo "Exit: $?"
Register with openclaw cron:
openclaw cron add \
--name "Sol — Descriptive Name" \
--schedule "0 9 * * 1,4" \
--session-target isolated \
--wake-mode now \
-- python3 /path/to/script.py
Verify it appears:
openclaw cron list
Crons with --announce deliver their stdout to Telegram. Scripts must:
# announce-mode: print to stdout for OpenClaw to deliver
if new_items:
print(f"Found {len(new_items)} new items:")
for item in new_items:
print(f" - {item}")
else:
print("No new items.")
exit(0) # silent success — no Telegram noise
# One-shot (for scripts, crons — preferred)
result = subprocess.run(
["ollama", "run", "qwen3:14b"],
input=prompt, capture_output=True, text=True, timeout=120
)
text = result.stdout.strip()
# Strip Ollama thinking block if present
if "...done thinking." in text:
text = text.split("...done thinking.")[-1].strip()
| Pattern | Where it lives |
|---|---|
| Blog content pipeline | scripts/content/blog-cron-v2.py |
| Repo Roulette state machine | scripts/content/repo-roulette/writer.py |
| SEO automation suite | scripts/seo/ |
| Email → publish pipeline | scripts/content/repo-roulette/scout.py |
python3 script.py manually firstopenclaw cron add with --session-target isolatedopenclaw cron run for one-shot testing — run the script directly firstset -euo pipefail in shell scripts called from OpenClaw crons — use plain set -e or explicit error handling