This document defines the canonical flow contracts for deterministic agent apps.
Use these contracts for:
- Starter preset expansion (
use preset "agent_workspace") - Controlled mode overrides (
~50lines) - Full custom agent graphs (
100+lines)
Input:
message: textcontext: optional text
Output:
route: textquery: textcontext: text
Input:
query: textcontext: optional text
Output:
context: textcitations: json
Input:
tool_name: text
Output:
allowed: booleanreason: text
Input:
message: textcontext: optional texterror_text: optional text
Output:
answer_text: textcitations: json
Input:
citations: json
Output:
citations: json
Input:
message: textcontext: optional text
Output:
answer_text: textcitations: json
- Flow names and field names are stable and case-sensitive.
- Contract field order is deterministic and must not be randomized.
n3 expandmust produce reproducible generated contracts for identical source.- New fields must be additive unless a contract version change is declared.
Starter (<=10 lines):
- rely on preset defaults and generated contracts
Controlled (~50 lines):
- keep contract names stable
- override internals, not contract shape
Supported controlled overrides for use preset "agent_workspace":
override flow "agent.route"override flow "agent.retrieve"override flow "agent.answer"override flow "agent.tool_policy"override flow "agent.fallback"override flow "agent.citations.format"
Override precedence is deterministic:
- If a supported flow is overridden, the override body is emitted.
- If a flow is not overridden, the preset default body is emitted.
- Contract signatures stay canonical in both cases.
Full custom (100+ lines):
- compose custom flow graphs while preserving canonical boundary contracts
Reference examples (canonical in namel3ss-apps):
- Starter:
apps/agent-workspace-starter/app.ai - Controlled:
apps/agent-workspace-controlled/app.ai - Full custom:
apps/agent-workspace-full-custom/app.ai
Related:
docs/runtime/agent_full_custom.md