Examples are intentionally split by compile profile for release safety:
- Strict-valid canonical examples: expected to compile with
--strict - Non-strict-only examples: useful compatibility demos that intentionally do not pass strict mode
- Legacy compatibility artifacts: retained for migration/training context
Not every file under examples/ is a safe template. CI enforces that every examples/**/*.ainl and examples/**/*.lang path is listed in tooling/artifact_profiles.json with a class (strict-valid, non-strict-only, or legacy-compat).
- Prefer
strict-validentries when teaching or generating new AINL. Those paths are checked withainl validate <path> --strictin tests. The full list is intooling/artifact_profiles.json→examples→strict-valid. - Ground-truth language and adapter rules live in
AGENTS.mdat the repo root (HTTP adapter,Do NOT, queue syntax, etc.). Read it before inventing adapters (e.g. there is noregex_findin this repo). - Classification and tables:
docs/EXAMPLE_SUPPORT_MATRIX.mdexplains canonical vs compatibility examples and points to the same JSON files. - Agentic payments & commerce (x402, MPP, AP2, ACP, AGTP): hub
docs/integrations/README.md— HTTP-402 profiles onhttp(HTTP_MACHINE_PAYMENTS.md), what is realistic in graphs today (AGENTIC_PROTOCOLS_PRACTITIONER_READINESS.md), and AGTP integration paths (AGTP.md). Strict-valid graph + local demo:examples/http/http_machine_payment_flow_compact.ainl+python scripts/run_http_machine_payment_roundtrip_demo.py(stdlib 402 server, two-step frame); MCP resourceainl://examples-http-machine-payment-flow. demo/is excluded from this contract by design — demos may use experimental syntax; do not treat them as strict references (seeAGENTS.mdApp Store section).- Benchmark-backed workflow examples (strict-valid, used in analytical token scripts):
examples/benchmark/enterprise_monitor.ainl,examples/workflows/data_pipeline.ainl,examples/workflows/lead_enrichment.ainl,examples/workflows/support_ticket_router.ainl— seedocs/CLAIMS_AND_EVIDENCE.mdandBENCHMARK.md.
The machine-readable source of truth is:
tooling/artifact_profiles.jsontooling/support_matrix.json
MCP / agents: the ainl://strict-valid-examples resource lists the same strict-valid paths as CI. The ainl://strict-valid-families resource (see docs/operations/MCP_AINL_WIZARD_AND_CORPUS.md) serves a mined family index from corpus/strict_valid_family_index.json (regenerate with tooling/corpus_mining.py when the strict-valid set changes significantly).
Quick checks:
python scripts/validate_ainl.py examples/hello.ainl --strict
python scripts/validate_ainl.py examples/blog.langSolana (R solana.*): For DERIVE_PDA, pass seeds_json as single-quoted JSON (recommended), e.g. '["market","ID"]', so inner " characters stay inside one token. You can also use one double-quoted string with escaped inner quotes — see adapters/solana.py module docstring. v1.8.0+ onboarding (Solana): docs/solana_quickstart.md (env vars, dry-run, emit flags, prediction-market patterns) and examples/prediction_market_demo.ainl.
Canonical strict-valid examples:
examples/hello.ainl— canonical single-label compute + return (R core.ADD+J).examples/http_get_minimal.ainl— minimalR http.GETwith URL-only positional args (noparams=/timeout=on theRline); seeAGENTS.mdHTTP adapter section. For HTTP 402 / x402 / MPP (payment_profile,http_paymentframe key), seedocs/integrations/HTTP_MACHINE_PAYMENTS.md, templateexamples/http/http_machine_payment_flow_compact.ainl, andpython scripts/run_http_machine_payment_roundtrip_demo.pyfor a self-contained local round-trip.examples/web/basic_web_api.ainl— canonical web endpoint flow (S core web,E, label body).examples/crud_api.ainl— canonicalSet+Ifbranch routing and explicit string literals.examples/scraper/basic_scraper.ainl— canonical scraper+cron intent (Sc+Cr) with runtime label flow.examples/rag_pipeline.ainl— canonicalCall ... ->outreturn binding pattern (no_call_resultcompatibility style).examples/retry_error_resilience.ainl— canonical resilience flow (R+Retry @nX+Err @nX+ explicit fallback label).examples/if_call_workflow.ainl— canonical branching + modular call composition (If+Call ... ->out).examples/webhook_automation.ainl— canonical webhook-style automation branch (validate->accepted/ignored) plus external action (R http.POST).examples/monitor_escalation.ainl— canonical scheduled monitoring/escalation (Cr+ condition branch ->escalate/noop).examples/monitoring/solana-balance.ainl— SolanaGET_BALANCE+ budget gate (core.gt); no runtime orchestration LLM; seedocs/solana_quickstart.md.examples/rag/cache-warmer.ainl—vector_memoryUPSERT/SEARCH with ops budget gate; run with--enable-adapter vector_memory.examples/crm/simple-lead-router.ainl—crm_db.Paudit rows + score branch + route budget gate; run with--enable-adapter crm_db(CRM_DB_PATHoptional).examples/status_branching.ainl— canonical status-branching example (Set+If->ok/alerted).examples/compact/github_raw_fetch_compact.ainl— compactR http.GETagainstraw.githubusercontent.com(URL + headers dict + timeout). Pattern for ArmaraOS agents that havehttp/web/shell_execbut no dedicatedgithubadapter — supply{Authorization: "Bearer <PAT>"}for private repos. To pull a whole repo agents typically pair this withR shell_exec.RUN "git clone --depth 1 …" ->_thenfile_list/file_readinside the workspace.
Canonical language scope reference:
docs/AINL_CANONICAL_CORE.mddocs/EXAMPLE_SUPPORT_MATRIX.md
Recommended canonical learning order (small-model first):
examples/hello.ainl(compute + return)examples/http_get_minimal.ainl(plainR http.GET— URL + optional{}headers + numeric timeout only; query string in URL)examples/crud_api.ainl(Set + If branch)examples/rag_pipeline.ainl(Call + bound return)examples/if_call_workflow.ainl(If + Call workflow)examples/retry_error_resilience.ainl(Retry + Err resilience)examples/web/basic_web_api.ainl(endpoint + DB read)examples/webhook_automation.ainl(validate/act/reject automation)examples/scraper/basic_scraper.ainl(scraper + cron + persistence)examples/monitor_escalation.ainl(scheduled monitor escalation)
Machine-readable curriculum source:
tooling/canonical_curriculum.json
Non-strict-only examples (intentional compatibility surface):
examples/api_only.langexamples/blog.langexamples/ecom.langexamples/internal_tool.langexamples/ticketing.langexamples/cron/monitor_and_alert.ainlexamples/openclaw/*.langexamples/autonomous_ops/*.langexamples/golden/*.ainl
Use non-strict examples for runtime/backward-compat demonstrations, not as strict language conformance references.
Canonical guidance for small-model reliability:
- Prefer uppercase adapter verbs in strict-valid examples (e.g.,
core.ADD,http.GET). - Prefer explicit
Call ... ->outreturn binding over compatibility fallback (_call_result) in canonical examples.
Comprehensive examples for all 42 AINL adapters. See ADAPTER_CATALOG.md for the complete adapter reference.
Full-featured email integration with IMAP/SMTP, HTML, attachments, threading, and drafts:
email_send_example.ainl- Basic email sendingemail_read_example.ainl- Read inbox with filtersemail_autoresponder.ainl- Auto-responder patternemail_reply_example.ainl- Reply with threading (In-Reply-To headers)email_draft_example.ainl- Draft creation and managementemail_html_example.ainl- HTML email with plain text fallbackemail_attachment_example.ainl- Send files as attachmentsEMAIL_ADAPTER_README.md- Complete email adapter documentation
Features: ✅ HTML email, ✅ Attachments, ✅ Threading, ✅ Drafts, ✅ Search
embedding_memory_example.ainl- Vector embeddings for RAG (UPSERT_REF, SEARCH)code_context_example.ainl- Tiered code chunking (INDEX, QUERY_CONTEXT)langchain_tool_example.ainl- LangChain tool integrationllm_example.ainl- LLM generation and chat (OpenAI, Anthropic)
github_example.ainl- GitHub API (repos, issues, PRs)api_example.ainl- Generic REST API wrapper (GET, POST, PUT, DELETE)
Most adapter examples require environment variables:
# Email
export [email protected]
export EMAIL_PASSWORD=app_specific_password
# LLM
export AINL_LLM_PROVIDER=openai
export OPENAI_API_KEY=sk-...
# GitHub
export GITHUB_TOKEN=ghp_...
# Adapter Security
export AINL_ALLOW_IR_DECLARED_ADAPTERS=1See individual example headers for specific requirements.
# Validate an example
ainl validate examples/email_send_example.ainl --strict
# Run an example (may have side effects!)
ainl run examples/email_send_example.ainlFor the complete list of all 42 adapters with targets, configuration, and usage patterns, see ADAPTER_CATALOG.md.