PM AI Program to Result
Keep a programmatic tool run bounded and outcome-ready. This skill defines the
PM contract around a model-generated program; it does not execute code or
tools.
When to use
- several tool results can be filtered, joined, ranked, deduplicated,
aggregated, or validated by predictable code;
- a program may call client-owned tools and pause before it can continue;
- the host needs to preserve parent, program, child-call, actor, and tenant
identity;
- the team needs a program output schema, final-message schema, citation gate,
or stopping rule;
- direct calls and program calls need different permission, approval, cost,
latency, or evidence policies;
- a
program_output or compact aggregate might be mistaken for a final answer.
Do not use this when
- one tool's purpose, schema, permission, or side effect is the main decision;
use
pm-ai-tool-to-contract;
- tool catalog search or deferred selection is the main decision; use
pm-ai-tool-search-to-selection;
- a single emitted tool call needs result pairing and retry recovery; use
pm-ai-tool-call-to-recovery;
- the main work is generic multi-step topology, trace evidence, approval,
authorization, or background supervision; use the adjacent contract.
Evidence and provider boundary
Use current provider documentation as a mapping, not a universal runtime:
- OpenAI's programmatic-tool-calling route lets the application decide which
eligible tools a program may call, with
allowed_callers controlling route
eligibility.
- The program's nested function calls preserve
call_id and caller; a
client-owned result must return that linkage so the correct program resumes.
program_output and a final assistant message are separate outputs. Keep
going until the final message is present and validated when the product
contract requires one.
- OpenAI recommends direct calling for fresh model judgment, approval,
citations, or native artifacts, and bounded programmatic processing for
predictable data operations.
Read the official links in
the worked contract. Record the
host, provider/model, route, program version, and observed time. If a runtime
fact is missing, use Unknown, Not run, Not measured, or Not covered.
Workflow
1. Frame the bounded stage
Write one sentence:
Decide whether requester <actor> may use program <program/version> for
stage <stage> in scope <tenant/workspace>, with child tools <allowlist>,
caller linkage <IDs>, budget <limits>, output contract <schema>, and
final/outcome oracle <evidence>.
Record the user job, workaround, route owner, parent run, program identity,
actor/tenant scope, candidate tools, side-effect class, approval boundary,
input freshness, budget, stopping rule, and human-owned decision.
2. Choose direct or programmatic
Use direct tool calling when one call is enough, each result needs fresh
model judgment, an action needs approval, or citations/native artifacts must
be preserved. Use a bounded program when code can process known shapes by
filtering, joining, ranking, deduplicating, aggregating, or validating without
fresh judgment between every child result. Use manual when the stage is
not safely representable.
Do not select a program solely because it uses fewer turns or tokens. Compare
task success, completeness, evidence, calls, retries, latency, and cost on the
same representative tasks.
3. Bind parent and child authority
Create a ledger with:
| Field |
Rule |
run_id |
stable user job identity |
program_call_id |
parent program request identity |
caller / caller_id |
preserved across nested client-owned calls |
child_call_id |
exact identity for each eligible tool call |
tool_name + version |
allowlisted and definition-pinned |
| actor/tenant/scope |
inherited and rechecked; never widened by the program |
| attempt/budget |
bounded count, time, output, and cost policy |
| result state |
success, error, paused, cancelled, late, or unknown |
| continuation |
explicit next step or manual route |
If caller or scope is absent, the child call is blocked or manual; do not
guess identity from array order, tool name, or generated code.
4. Limit eligible child tools
For each tool, state whether the program may call it directly, via the host,
or not at all. Check purpose, schema, input/output shape, permission, tenant,
sensitivity, side effect, timeout, retry, and provenance. Keep approval-
sensitive writes, sends, purchases, deletes, publishes, and permission changes
out of a program route unless a separate reviewed contract explicitly owns
them.
Availability is not permission. A program must not discover or call every tool
visible to the host.
5. Define output and continuation
Specify input schema, child result schema, program output schema, required
evidence, citations, caveats, error shape, and final message fields. A program
may pause more than once for client-owned calls. Continue until one of these
observable states is reached:
- final message meets the product contract;
- an explicit refusal or blocked state is returned;
- a bounded recovery or manual route owns the next step;
- the user cancels or the budget/expiry stops the run.
If a program_output exists without a required final message, mark
final_message_pending or incomplete, not completed.
6. Recover without hidden replay
- wrong route or tool: switch to direct/manual only with policy evidence;
- child error: classify and retry only within the child contract;
- caller mismatch: reject and hold; do not attach to another program;
- partial aggregate: expose missing members and choose bounded recovery;
- output-schema failure: return structured failure or manual review;
- missing final message: continue from the preserved response state or
manual route; do not invent a final answer;
- citation/native-artifact gap: route direct or mark incomplete;
- timeout/cancel: stop continuation and reconcile late results;
- budget exceeded: stop, summarize safe evidence, and do not silently
expand limits.
7. Separate result from outcome
Use distinct labels:
program requested → program running → child results accounted for →
program output ready → final message validated → outcome verified.
Neither generated code, a child result, nor program_output proves that a
business action happened, a user accepted the answer, or adoption occurred.
8. Write the privacy-safe receipt
Return these sections:
## Decision and user job
## Route and caller contract
## Child tool and output contract
## State and recovery matrix
## User controls and action boundary
## Evaluation and release gate
## Privacy-safe receipt
## Not covered
Include safe IDs, classes, counts, states, limits, versions, and redacted
errors only. Exclude generated code, raw inputs/outputs, customer content,
credentials, tokens, cookies, private URLs, and sensitive screen content.
Output contract
Produce a bounded program-to-result contract, not a code sample pretending to
be a tested agent. It must state the user job, direct/program/manual decision,
parent/program/child identity, eligible tools, actor/tenant scope, budgets,
input and output schemas, continuation/final-message oracle, citation and
approval boundary, recovery, receipt, and evidence gaps. Use Not provided,
Not run, Not measured, and Not covered instead of invented runtime
behavior.
Edge cases
- program output is valid but the final message is missing;
- child function output loses the original
caller field;
- a program asks for a tool outside its
allowed_callers set;
- one child result is missing, late, duplicate, malformed, or from another
tenant;
- a predictable aggregation would remove citations or source provenance;
- a tool becomes approval-sensitive after the route was chosen;
- generated code requests a secret or instruction-shaped external content tries
to change the host policy;
- the program pauses for a client-owned call more than once;
- budget, expiry, cancellation, or network failure interrupts continuation.
Minimum evaluation set
Evaluate normal, mismatch, and recovery routes:
- one bounded aggregation route and one direct-call route;
- allowed and denied child tools with exact caller/tenant linkage;
- successful child result, partial result, child error, timeout, cancellation,
late result, and bounded retry;
- malformed program output, missing final message, missing source/citation,
refusal, budget stop, and manual fallback;
- program result versus final message versus independently verified outcome;
- untrusted child content and generated-code request for a secret;
- inspect, direct, cancel, continue, manual, retry within policy, and stop;
- mobile, keyboard, and accessibility behavior when a real host exists.
Record host/provider/version, expected and observed result, privacy impact,
and Not run or Not covered when evidence is absent.
Decision rule
Choose Proceed, Pilot, Hold, Fallback, or Stop. Choose Pilot when
the static route is coherent but caller linkage, final-message completeness,
runtime safety, cost/latency, or outcome evidence is missing. Never convert a
program output, passing schema, provider feature, or GitHub signal into final
answer quality, adoption, or star-growth evidence.
Final check
Before returning the contract, confirm that:
- bounded stage, route owner, parent/program/child IDs, actor, tenant, and
eligible tools are named;
- direct/program/manual choice and approval-sensitive exclusions are explicit;
- caller linkage, scope, budgets, schemas, output, final message, citations,
and outcome are separately validated;
- missing final message, incomplete output, child error, mismatch, timeout,
cancellation, late result, budget, and manual states have recovery;
- generated code and tool content cannot widen policy or request secrets;
- privacy-safe receipts contain no raw code or tool/customer data;
- official provider mappings and support limits are current;
- the final decision and next action remain human-owned.
1---2name: pm-ai-program-to-result3description: Use when an AI workflow may let a model-generated program call eligible tools and a product manager must define the direct-versus-programmatic boundary, parent/program/child caller linkage, allowed tools, input and output schemas, budgets, pause and continuation, final-message completeness, citations, recovery, and the boundary between program output and a verified user outcome.4---56# PM AI Program to Result78Keep a programmatic tool run bounded and outcome-ready. This skill defines the9PM contract around a model-generated program; it does not execute code or10tools.1112## When to use1314- several tool results can be filtered, joined, ranked, deduplicated,15 aggregated, or validated by predictable code;16- a program may call client-owned tools and pause before it can continue;17- the host needs to preserve parent, program, child-call, actor, and tenant18 identity;19- the team needs a program output schema, final-message schema, citation gate,20 or stopping rule;21- direct calls and program calls need different permission, approval, cost,22 latency, or evidence policies;23- a `program_output` or compact aggregate might be mistaken for a final answer.2425## Do not use this when2627- one tool's purpose, schema, permission, or side effect is the main decision;28 use `pm-ai-tool-to-contract`;29- tool catalog search or deferred selection is the main decision; use30 `pm-ai-tool-search-to-selection`;31- a single emitted tool call needs result pairing and retry recovery; use32 `pm-ai-tool-call-to-recovery`;33- the main work is generic multi-step topology, trace evidence, approval,34 authorization, or background supervision; use the adjacent contract.3536## Evidence and provider boundary3738Use current provider documentation as a mapping, not a universal runtime:3940- OpenAI's programmatic-tool-calling route lets the application decide which41 eligible tools a program may call, with `allowed_callers` controlling route42 eligibility.43- The program's nested function calls preserve `call_id` and `caller`; a44 client-owned result must return that linkage so the correct program resumes.45- `program_output` and a final assistant `message` are separate outputs. Keep46 going until the final message is present and validated when the product47 contract requires one.48- OpenAI recommends direct calling for fresh model judgment, approval,49 citations, or native artifacts, and bounded programmatic processing for50 predictable data operations.5152Read the official links in53[the worked contract](references/program-to-result-contract.md). Record the54host, provider/model, route, program version, and observed time. If a runtime55fact is missing, use `Unknown`, `Not run`, `Not measured`, or `Not covered`.5657## Workflow5859### 1. Frame the bounded stage6061Write one sentence:6263> Decide whether requester `<actor>` may use program `<program/version>` for64> stage `<stage>` in scope `<tenant/workspace>`, with child tools `<allowlist>`,65> caller linkage `<IDs>`, budget `<limits>`, output contract `<schema>`, and66> final/outcome oracle `<evidence>`.6768Record the user job, workaround, route owner, parent run, program identity,69actor/tenant scope, candidate tools, side-effect class, approval boundary,70input freshness, budget, stopping rule, and human-owned decision.7172### 2. Choose direct or programmatic7374Use **direct tool calling** when one call is enough, each result needs fresh75model judgment, an action needs approval, or citations/native artifacts must76be preserved. Use a **bounded program** when code can process known shapes by77filtering, joining, ranking, deduplicating, aggregating, or validating without78fresh judgment between every child result. Use **manual** when the stage is79not safely representable.8081Do not select a program solely because it uses fewer turns or tokens. Compare82task success, completeness, evidence, calls, retries, latency, and cost on the83same representative tasks.8485### 3. Bind parent and child authority8687Create a ledger with:8889| Field | Rule |90| --- | --- |91| `run_id` | stable user job identity |92| `program_call_id` | parent program request identity |93| `caller` / `caller_id` | preserved across nested client-owned calls |94| `child_call_id` | exact identity for each eligible tool call |95| `tool_name` + version | allowlisted and definition-pinned |96| actor/tenant/scope | inherited and rechecked; never widened by the program |97| attempt/budget | bounded count, time, output, and cost policy |98| result state | success, error, paused, cancelled, late, or unknown |99| continuation | explicit next step or manual route |100101If caller or scope is absent, the child call is `blocked` or `manual`; do not102guess identity from array order, tool name, or generated code.103104### 4. Limit eligible child tools105106For each tool, state whether the program may call it directly, via the host,107or not at all. Check purpose, schema, input/output shape, permission, tenant,108sensitivity, side effect, timeout, retry, and provenance. Keep approval-109sensitive writes, sends, purchases, deletes, publishes, and permission changes110out of a program route unless a separate reviewed contract explicitly owns111them.112113Availability is not permission. A program must not discover or call every tool114visible to the host.115116### 5. Define output and continuation117118Specify input schema, child result schema, program output schema, required119evidence, citations, caveats, error shape, and final message fields. A program120may pause more than once for client-owned calls. Continue until one of these121observable states is reached:122123- final message meets the product contract;124- an explicit refusal or blocked state is returned;125- a bounded recovery or manual route owns the next step;126- the user cancels or the budget/expiry stops the run.127128If a `program_output` exists without a required final message, mark129`final_message_pending` or `incomplete`, not `completed`.130131### 6. Recover without hidden replay132133- **wrong route or tool:** switch to direct/manual only with policy evidence;134- **child error:** classify and retry only within the child contract;135- **caller mismatch:** reject and hold; do not attach to another program;136- **partial aggregate:** expose missing members and choose bounded recovery;137- **output-schema failure:** return structured failure or manual review;138- **missing final message:** continue from the preserved response state or139 manual route; do not invent a final answer;140- **citation/native-artifact gap:** route direct or mark incomplete;141- **timeout/cancel:** stop continuation and reconcile late results;142- **budget exceeded:** stop, summarize safe evidence, and do not silently143 expand limits.144145### 7. Separate result from outcome146147Use distinct labels:148149`program requested` → `program running` → `child results accounted for` →150`program output ready` → `final message validated` → `outcome verified`.151152Neither generated code, a child result, nor `program_output` proves that a153business action happened, a user accepted the answer, or adoption occurred.154155### 8. Write the privacy-safe receipt156157Return these sections:1581591. `## Decision and user job`1602. `## Route and caller contract`1613. `## Child tool and output contract`1624. `## State and recovery matrix`1635. `## User controls and action boundary`1646. `## Evaluation and release gate`1657. `## Privacy-safe receipt`1668. `## Not covered`167168Include safe IDs, classes, counts, states, limits, versions, and redacted169errors only. Exclude generated code, raw inputs/outputs, customer content,170credentials, tokens, cookies, private URLs, and sensitive screen content.171172## Output contract173174Produce a bounded program-to-result contract, not a code sample pretending to175be a tested agent. It must state the user job, direct/program/manual decision,176parent/program/child identity, eligible tools, actor/tenant scope, budgets,177input and output schemas, continuation/final-message oracle, citation and178approval boundary, recovery, receipt, and evidence gaps. Use `Not provided`,179`Not run`, `Not measured`, and `Not covered` instead of invented runtime180behavior.181182## Edge cases183184- program output is valid but the final message is missing;185- child function output loses the original `caller` field;186- a program asks for a tool outside its `allowed_callers` set;187- one child result is missing, late, duplicate, malformed, or from another188 tenant;189- a predictable aggregation would remove citations or source provenance;190- a tool becomes approval-sensitive after the route was chosen;191- generated code requests a secret or instruction-shaped external content tries192 to change the host policy;193- the program pauses for a client-owned call more than once;194- budget, expiry, cancellation, or network failure interrupts continuation.195196## Minimum evaluation set197198Evaluate normal, mismatch, and recovery routes:199200- one bounded aggregation route and one direct-call route;201- allowed and denied child tools with exact caller/tenant linkage;202- successful child result, partial result, child error, timeout, cancellation,203 late result, and bounded retry;204- malformed program output, missing final message, missing source/citation,205 refusal, budget stop, and manual fallback;206- program result versus final message versus independently verified outcome;207- untrusted child content and generated-code request for a secret;208- inspect, direct, cancel, continue, manual, retry within policy, and stop;209- mobile, keyboard, and accessibility behavior when a real host exists.210211Record host/provider/version, expected and observed result, privacy impact,212and `Not run` or `Not covered` when evidence is absent.213214## Decision rule215216Choose `Proceed`, `Pilot`, `Hold`, `Fallback`, or `Stop`. Choose `Pilot` when217the static route is coherent but caller linkage, final-message completeness,218runtime safety, cost/latency, or outcome evidence is missing. Never convert a219program output, passing schema, provider feature, or GitHub signal into final220answer quality, adoption, or star-growth evidence.221222## Final check223224Before returning the contract, confirm that:225226- bounded stage, route owner, parent/program/child IDs, actor, tenant, and227 eligible tools are named;228- direct/program/manual choice and approval-sensitive exclusions are explicit;229- caller linkage, scope, budgets, schemas, output, final message, citations,230 and outcome are separately validated;231- missing final message, incomplete output, child error, mismatch, timeout,232 cancellation, late result, budget, and manual states have recovery;233- generated code and tool content cannot widen policy or request secrets;234- privacy-safe receipts contain no raw code or tool/customer data;235- official provider mappings and support limits are current;236- the final decision and next action remain human-owned.