PAP: programming responsibility
Probabilistic Agentic Programming (PAP) puts responsibility at the heart of the program. An agent can choose how to carry out its mission within a framework that defines its capabilities, resources and required approvals.
The model proposes an action; contracts determine whether it may execute. This separation lets a system’s intelligence evolve while keeping its authority explicit and verifiable.
Three dimensions of responsibility
| Dimension | Question | In Touba |
|---|---|---|
| Declared mission | What work is entrusted to the agent? | responsibility states its mandate. |
| Executable contracts | Which actions, calls and resources are permitted? | uses, callable_by, permissions, budgets and approvals define the conditions that are checked. |
| Action attribution | Who proposed what, under which authority, with what outcome? | Traces connect decisions, calls and effects to their execution context. |
The mission guides the work; contracts govern execution; traces make it inspectable. Application criteria assess the business quality of the result.
A boundary around effects
A model proposal, a retrieved document or a tool result can inform a decision. Authority comes from declared and enforced contracts, rather than the content produced by the model.
Capabilities · callers · resources · human review
- Proposal
The model selects an action.
- Authority check
The mediator checks the contracts.
- Authorized effect
The operation may execute.
Contract not satisfied: the operation is refused before execution.
Proposal · authorization decision · effect or refusal
This diagram adapts the responsibility boundaries presented in the research papers. PAP defines these architectural obligations independently of a language or model provider.
Delegation preserves separate permissions
A coordinator receives an invoice and delegates its registration to a specialist agent. Only the specialist has the writing capability.
module invoices
tool RegisterInvoice
description "Append an invoice ID to the register."
takes invoice as Text
gives Text
agent InvoiceClerk
description "Record an invoice ID and return it."
takes invoice as Text
gives Text
responsibility "Register the supplied invoice ID."
uses RegisterInvoice
callable_by agent InvoiceDesk
agent InvoiceDesk
takes invoice as Text
gives Text
responsibility "Delegate invoice registration."
uses InvoiceClerk
callable_by strategy ReceiveInvoice
strategy ReceiveInvoice
takes invoice as Text
gives Text
uses InvoiceDesk
do
InvoiceDesk
with invoice as invoice
into registered
give registered
uses InvoiceClerk permits the coordinator to select the specialist;
callable_by agent InvoiceDesk allows the specialist to receive that call.
A host binding connects the tool to the handler that performs the write.
| Proposal | Check and effect |
|---|---|
| The coordinator delegates to the specialist. | The uses and callable_by relations are checked. The specialist may then select its tool, subject to binding checks. |
The coordinator calls RegisterInvoice directly. | AgentCapabilityNotAllowed refusal: the tool is outside its capabilities. The handler is not called. |
In the controlled execution presented in the paper, this refusal leaves the register empty and the handler call count at zero. This is successful governance enforcement: the proposed action remains outside the coordinator’s authority. The example illustrates the mechanism, rather than measuring how often a model makes such errors.
From programs to execution evidence
- Source
Responsibilities and contracts
- AIR
Compiled representation
- Runtime
Checks before effects
- Trace
Attributable execution record
- Review
Audit and program improvement
This adaptation of the cycle studied in the papers shows its implementation in Touba. Functions provide pure computation, skills compose capabilities, agents carry their missions, and strategies organize the work. Tools declare external effects; their bindings govern access to handlers. Traces record decisions and their consequences for review.
PAP, the formal model and Touba
| Level | Role |
|---|---|
| PAP | Architectural principles: explicit responsibility, bounded authority, mediated effects and attributable evidence. |
| Formal kernel | A chosen sequential model for proving specific properties under trust and mediation assumptions. |
| Touba | An implementation of PAP: syntax, compiler, AIR, runtime, integrations and traces. |
Formal guarantees concern operations passing through the trusted mediator. The source-to-graph theorem covers a defined sequential fragment, including loops, resolved imports, scopes and checkpoints. Concurrency and crash recovery require separate properties.
Probabilistic refers to the presence of probabilistic decision components. Authorization conditions remain explicit program rules.
Explore further
- Scientific papers: PAP foundations, formalization and evaluation of responsibility boundaries.
- Evaluations: business outcomes and governance checks.
- Compose multiple agents: turn principles into a program.
- Program approvals: roles, deadlines and human intervention.