Beyond Generic Prompts: Building Real AI Workflows with AINL
Most AI tools still feel like clever but isolated assistants. You give them a prompt, they generate an answer, and you’re left stitching together the rest — copying outputs, checking data, triggering follow-ups, and hoping nothing breaks in production.
AINL changes that.
Instead of one-off prompts, AINL lets you build AI-native graphs — structured, auditable, reactive workflows that combine LLMs, databases, memory, queues, APIs, and realtime events into complete, operational programs. Every step is explicit, deterministic, and observable. The graph reacts to live data, remembers state, and scales with full async support.
Databases are just one piece. AINL shines when you weave together adapters for LLMs, memory, queues, HTTP calls, filesystem, and more — all in one clean graph.
What AINL Actually Gives You
- Native Async Runtime — full async execution with concurrency so graphs can handle realtime streams and parallel steps efficiently.
- Pluggable Adapters — clean, secure interfaces for:
- Databases (Postgres, MySQL, DynamoDB, Supabase, Airtable, SQLite)
- Memory & state (
memory,vector_memory,cache) - Queues & pub/sub (
rediswith full async verbs) - External APIs & tools (
http, filesystem) - LLMs (
llm_query, custom model runners)
- Reactive Primitives — built-in support for DynamoDB Streams (with checkpointing/ack), Supabase Realtime (fan-out, replay, cursor), and Redis pub/sub.
- Observability & Durability — structured metrics (latency, events per batch, lag, ack success) with JSONL sink, plus production templates and guides for Redis- or Postgres-backed checkpoints.
- Production Starter Templates — ready-to-use graph patterns in
templates/production/for common scenarios.
The result is not just smarter responses — it’s complete, self-contained AI programs that operate reliably in production.
Real-World Workflow Examples
Here are three practical programs you can build today.
1. Automated Customer Onboarding Pipeline
Trigger on new user record in Supabase → enrich with LLM → send welcome email via HTTP → store state in memory/Redis.
S onboarding core new_user
L1:
R supabase.realtime.subscribe "users" "users" ["INSERT"] null 1.0 10 ->event
R llm_query "Generate personalized welcome message and suggested next steps for user" $event.record ->enriched
R http.post "https://api.sendgrid.com/v3/mail/send" {"to": $event.record.email, "subject": "Welcome!", "body": $enriched.message} ->email_sent
R memory.put "session" "onboarding" $event.record.id {"status": "completed", "enriched": $enriched} 86400 ->saved
R supabase.realtime.ack "users" $event.sequence "onboarding" "worker-1" ->ack
J ack
2. Realtime Research Agent
New research topic in DynamoDB → web search via HTTP adapter → LLM summarization → queue results for review.
S research core topic
L1:
R dynamodb.streams.subscribe "research_topics" "LATEST" {"event_names":["INSERT"]} 0.5 20 "research" "agent-1" "memory" ->topic
R http.get "https://api.search.example.com" {"q": $topic.record.query} ->search_results
R llm_query "Summarize these search results into key insights and action items" $search_results ->summary
R redis.rpush "queue:review" $summary ->queued
R dynamodb.streams.ack "research_topics" "shard-000" $topic.events[-1].dynamodb.SequenceNumber "research" "agent-1" ->ack
J ack
3. Internal Monitoring & Alerting Dashboard Trigger
Database change or Redis pub/sub event → generate report with LLM → post to Slack/HTTP → log to filesystem.
S monitoring core alert
L1:
R redis.subscribe "events:alerts" 1.0 15 ->alert
R llm_query "Generate concise incident report and recommended actions" $alert ->report
R http.post "https://hooks.slack.com/services/..." {"text": $report.summary} ->slack
R fs.write "/logs/incidents/" $alert.id $report.full_report ->logged
J logged
These aren’t toy examples — they are complete, observable, durable programs that combine multiple adapters in a single graph.
Getting Started
- Clone the repo and explore the production templates in
templates/production/. - Read the core patterns in
docs/reactive/REACTIVE_EVENTS.md. - Learn durability strategies in
docs/reactive/ADVANCED_DURABILITY.md. - Run any graph with async and observability:
AINL_RUNTIME_ASYNC=1 AINL_OBSERVABILITY=1 AINL_OBSERVABILITY_JSONL=/tmp/ainl-metrics.jsonl \
ainl run templates/production/hybrid_stream_to_realtime.ainl \
--runtime-async --observability --observability-jsonl /tmp/ainl-metrics.jsonl \
--enable-adapter dynamodb --enable-adapter supabase --enable-adapter redis
Next Steps
AINL gives you the foundation to move from generic prompting to real operational AI systems. Start small with one template, then layer in your own logic, adapters, and custom steps.
What will you build first — a customer onboarding flow, a realtime research agent, an internal alerting system, or something completely new?
We’d love to see your graphs. Share them on GitHub or in the community — the best ideas often come from users pushing these patterns in unexpected directions.
