Examples
All example commands are run from the repository root.
Most live examples use AIOC_EXAMPLE_PROVIDER=openai or
AIOC_EXAMPLE_PROVIDER=mistral plus the matching provider API key. Optionally
set AIOC_EXAMPLE_MODEL to override the default live model.
Start Here
Section titled “Start Here”npm run example:hellonpm run example:policynpm run example:approval-requirednpm run example:tool-policynpm run example:policy-composition
These are the compact examples intended for first reading. They cover the smallest useful agent run, policy gates, approval-required results, tool execution, and exact-name policy composition.
Approval and Audit
Section titled “Approval and Audit”npm run example:approval-evidencenpm run example:run-record
example:approval-evidence shows how an external approval can be projected
into policy context and reevaluated deterministically. example:run-record
shows how to persist a redacted RunRecord through a sink.
RunRecord Utility Snippets
Section titled “RunRecord Utility Snippets”npm run example:rru:01-extractnpm run example:rru:02-comparenpm run example:rru:03-replay-strictnpm run example:rru:04-replay-hybrid
These examples are deterministic and runnable without a live provider. They are small reference snippets for extracting tool calls, comparing records, and replaying recorded runs.
Harness Descriptor Examples
Section titled “Harness Descriptor Examples”npm run example:harness-rerunnpm run example:harness
example:harness-rerun is the compact descriptor example: it configures OpenAI
from OPENAI_API_KEY, declares the model in inline YAML, records a source run,
and replays it against a modified harness while mocking a newly introduced tool
output.
example:harness is the fuller descriptor example. It demonstrates reusable
instruction_parts, ordered instructions_sequence, boolean where gates,
tool registry binding, and descriptor hashing.
Advanced Workflows
Section titled “Advanced Workflows”npm run example:non-regressionnpm run example:run-regressionnpm run example:run-regression-judge
example:non-regression compares RunRecord outputs across two harness
versions. It uses a live provider and is educational rather than deterministic.
example:run-regression records a baseline RunRecord, runs a modified
OpenAI-backed harness through runRegressionSuite(...), and prints the
deterministic comparison summary without using a judge.
example:run-regression-judge extends the same age-adapted regression flow with
createRunRegressionJudge(...). The judge package builds the bounded judge
input and prompt; the example supplies the actual OpenAI-backed model call.
The regression CLI artifact example lives in
packages/aioc-regression-cli/examples/age-adapted/. It shows the same kind of
workflow using stored RunRecord JSON, descriptor YAML, an expectation file,
and an application-owned .mjs adapter.
Optional LangChain Interoperability
Section titled “Optional LangChain Interoperability”Optional LangChain examples live in /examples/langchain and use an isolated
package.json, so LangChain dependencies do not become runtime dependencies of
@axiastudio/aioc.
They demonstrate three composition patterns:
- aioc-first, LangChain-extended: aioc owns the governed agent run while LangChain provides OSS components behind aioc tools. The RAG example mirrors the LangChain RAG tutorial domain and uses a LangChain retriever inside a policy-gated aioc tool.
- LangGraph-orchestrated, aioc-governed: LangGraph owns workflow
orchestration while selected graph nodes call
aioc.run(...)for sensitive capability execution. The LangGraph example mirrors the calculator quickstart domain and routes the governed step through aioc policy andRunRecordcapture. - LangGraph-orchestrated, aioc-recorded: LangGraph owns workflow
orchestration while a local RFC-0013 prototype wraps the compiled graph and
emits a graph-level
RunRecord.
For governed execution, execution-impacting capabilities should cross the aioc governance boundary. LangChain supplies breadth and orchestration; aioc supplies default-deny authorization, deterministic policy decisions, and portable audit evidence.
Canonical Guide
Section titled “Canonical Guide”For the curated learning path, see the repository document:
/docs/CANONICAL-EXAMPLES.md
For the approval model and policy-reevaluation flow, see:
/approval-flows/