惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
APX Routines Are Deterministic Pipelines Around AI
Manuel Bruña · 2026-06-15 · via DEV Community

APX Routines Are Deterministic Pipelines Around AI

A lot of agent automation fails because everything is treated like a prompt. The model gets a vague instruction, some tools, and a schedule, then everyone hopes the same thing happens tomorrow.

APX routines take a different shape. The agent part can still be flexible, but the shell around it is deterministic.

That shell is the important part:

pre_commands -> prompt -> agent result -> post_commands

A routine is not only "run this prompt every day." It is a small pipeline where each stage has a clear role.

Pre-commands collect facts

pre_commands run before the prompt. They are plain shell commands, executed in order.

That makes them useful for facts that should not depend on the model:

  • fetch weather
  • inspect build output
  • read a local status file
  • query an API
  • collect git changes
  • grep logs
  • prepare a compact context block

For example, a weather routine can run:

curl -s 'https://wttr.in/Bariloche?format=%t+feels+%f+%C+wind+%w' \
  2>/dev/null || echo 'No weather data'

The model does not need to decide how to fetch the weather. The routine gives it the exact input.

The prompt consumes pre-output

The combined stdout from pre_commands becomes available inside the prompt as:

{{pre_output}}

That turns the prompt into a deterministic handoff point:

The following is current weather data for Bariloche, Argentina:

{{pre_output}}

The LLM still decides how to summarize or reason about the data, but the data capture itself is explicit and repeatable.

That distinction matters. It keeps the fuzzy part where it belongs: interpretation, not input collection.

Post-commands decide what happens next

After the routine kind runs, post_commands run as shell commands too.

That is where you can deliver or archive the result:

apx telegram send "$APX_LLM_OUTPUT"

This is especially clean with exec_agent: the model writes text, then the shell sends it. The agent does not need Telegram tool access just to deliver one message.

Use super_agent when the routine must actually operate with tools. Use exec_agent when the product is text and the post step can handle delivery.

Available variables are the contract

The UI exposes the important variables because they are the contract between stages.

Available in the prompt:

{{pre_output}}

Available in post commands:

$APX_LLM_OUTPUT
$APX_STATUS
$APX_SKIPPED
$APX_PRE_OUTPUT
$APX_PRE_OUTPUT_FILE
$APX_PRE_EXIT
$APX_ROUTINE

Available in pre and post commands:

$APX_ROUTINE

These variables make routine behavior easier to debug. You can see what was collected, whether the pre step failed, whether the prompt was skipped, what the model returned, and which routine produced the run.

That is a better automation surface than "the agent probably did something."

Why this feels different

The point is not to make AI deterministic. The point is to make the automation boundary deterministic.

APX routines give you:

  • deterministic data collection before the model
  • explicit prompt injection through {{pre_output}}
  • deterministic delivery or cleanup after the model
  • visible status through $APX_STATUS and $APX_SKIPPED
  • file-safe access to longer pre-output through $APX_PRE_OUTPUT_FILE

That is the useful compromise. The LLM can still write, reason, or summarize. The routine decides when it runs, what facts it receives, and what happens with the output.

For scheduled agent work, that boundary is the difference between a clever demo and something you can keep running.

APC keeps the project context portable. APX routines turn that context into predictable local behavior. Pre-commands, post-commands, and available variables are the small pieces that make it practical.