Examples Overview
Complete, runnable examples for common use cases - Get started quickly with production-ready code.
Available Examples
Browse our collection of production-ready examples. Each example is complete, tested, and ready to deploy.
Quick Reference
| Example | Industry | Complexity | Features | Time to Deploy |
|---|---|---|---|---|
| Hello World | All | Beginner | Basic query + policy | 5 minutes |
| Customer Support | Support | Intermediate | PII redaction, RBAC, audit | 10 minutes |
| Banking AI Assistant | Banking | Advanced | RBI, PCI-DSS, Fraud Detection, PII | 45 minutes |
| Healthcare Assistant | Healthcare | Advanced | HIPAA, PII, RBAC | 30 minutes |
| E-commerce Recommendations | Retail | Intermediate | Product data, personalization | 20 minutes |
| Trip Planner | Travel | Advanced | MAP, MCP, LLM integration | 30 minutes |
Hello World
The simplest AxonFlow example - Perfect for learning the basics.
What It Demonstrates
- Basic query execution
- Simple policy enforcement
- Request/response handling
- Audit logging
Code
TypeScript (30 lines):
import { AxonFlowClient } from '@axonflow/sdk';
const client = new AxonFlowClient({
endpoint: 'https://YOUR_AGENT_ENDPOINT',
licenseKey: 'YOUR_LICENSE_KEY',
organizationId: 'my-org'
});
async function main() {
const response = await client.executeQuery({
query: 'What is the capital of France?',
policy: `
package axonflow.policy
default allow = true
`
});
console.log('Response:', response.result);
console.log('Latency:', response.metadata.latency_ms + 'ms');
}
main();
Go (35 lines):
package main
import (
"context"
"fmt"
"log"
"github.com/getaxonflow/axonflow-sdk-go"
)
func main() {
client, _ := axonflow.NewClient(axonflow.Config{
Endpoint: "https://YOUR_AGENT_ENDPOINT",
LicenseKey: "YOUR_LICENSE_KEY",
OrganizationID: "my-org",
})
response, err := client.ExecuteQuery(context.Background(), &axonflow.QueryRequest{
Query: "What is the capital of France?",
Policy: `
package axonflow.policy
default allow = true
`,
})
if err != nil {
log.Fatal(err)
}
fmt.Println("Response:", response.Result)
fmt.Printf("Latency: %dms\n", response.Metadata.LatencyMS)
}
Quick Start
# Clone example
git clone https://github.com/axonflow/examples
cd examples/hello-world
# TypeScript
cd typescript
npm install
npm start
# Go
cd go
go run main.go
GitHub
Banking AI Assistant
RBI/PCI-DSS compliant banking AI assistant - Production-ready fraud detection and loan processing.
What It Demonstrates
- Real-time fraud detection with AI-powered pattern analysis
- Loan application processing with instant preliminary assessment
- PII protection (SSN, account numbers) automatically
- Regulatory compliance (ECOA, FCRA, TILA, RBI)
- Complete audit trails for compliance requirements
- In-VPC deployment for data sovereignty
Features
✅ Fraud Detection:
- Impossible travel detection
- Unusual transfer monitoring
- Card cloning detection
- Risk scoring (0-10 scale)
✅ Loan Processing:
- Debt-to-income ratio analysis
- Income multiple validation
- Compliance checking (ECOA, FCRA, TILA)
- Instant preliminary assessment
✅ PII Protection:
- Automatic SSN redaction
- Account number masking
- Credit card protection
- Contact information partial masking
✅ Compliance:
- RBI guidelines built-in
- PCI-DSS support
- Complete audit logging
- CloudWatch integration
Architecture
Quick Start
Note: Full implementation available to AWS Marketplace customers. See Banking Example for details.
# Clone repository (customers only)
git clone https://github.com/axonflow/examples
cd examples/banking-assistant
# Setup
npm install
docker-compose up -d
# Run
npm run dev
# Access at http://localhost:3000
Policy Example
package axonflow.policy.banking
import future.keywords
# Block suspicious transactions
deny["Suspicious: impossible travel"] {
input.transactions[i].location != input.transactions[j].location
time_diff := abs(input.transactions[i].timestamp - input.transactions[j].timestamp)
time_diff < 300 # 5 minutes
}
# Redact SSN from all queries
redacted_query := regex.replace(
input.query,
`\b\d{3}-\d{2}-\d{4}\b`,
"***-**-****"
)
# RBI compliance - data sovereignty
deny["RBI violation: cross-border data transfer"] {
input.context.data_location != "IN"
input.context.customer_region == "IN"
}
Performance
| Operation | Latency | Notes |
|---|---|---|
| Fraud pattern analysis | <50ms | Real-time detection |
| Loan assessment | <100ms | Full DTI calculation |
| PII detection | <5ms | Automatic redaction |
| Policy enforcement | <10ms P95 | Single-digit ms typical |
GitHub
Documentation
Healthcare Assistant
HIPAA-compliant medical AI assistant - Production-ready healthcare example.
What It Demonstrates
- HIPAA compliance patterns
- PII detection and redaction
- Role-based access control (RBAC)
- Patient data access controls
- Multi-agent coordination
- Audit trail for compliance
- HL7/FHIR integration patterns
Features
✅ HIPAA Compliance:
- Encryption at rest and in transit
- Access controls and audit logging
- Minimum necessary rule enforcement
- PHI (Protected Health Information) protection
- Breach notification procedures
✅ Security:
- Role-based permissions (Doctor, Nurse, Admin)
- Patient assignment validation
- Business hours enforcement
- Emergency access procedures
- Comprehensive audit trail
✅ Technical:
- React frontend with TypeScript
- Go backend with PostgreSQL
- AxonFlow policy enforcement
- Real-time audit logging
- CloudWatch integration
Use Cases
-
Patient Records Access
- Doctors access assigned patients only
- Nurses have limited read access
- Admins have full access with audit trail
-
Prescription Management
- Drug interaction checking
- Dosage validation
- Prescription history tracking
-
Lab Results
- Automated result distribution
- Critical result alerts
- Access based on patient assignment
-
Appointment Scheduling
- Availability checking
- Conflict detection
- Automated reminders
Architecture
Quick Start
# Clone repository
git clone https://github.com/axonflow/examples
cd examples/healthcare-assistant
# Setup database
docker-compose up -d postgres
# Run backend
cd backend
go run main.go
# Run frontend
cd frontend
npm install
npm start
# Access at http://localhost:3000
Configuration
Environment Variables:
# AxonFlow
AXONFLOW_ENDPOINT=https://your-agent-endpoint
AXONFLOW_LICENSE_KEY=AXON-V2-xxx-yyy
AXONFLOW_ORG_ID=healthcare-org
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/healthcare
# FHIR Integration (optional)
FHIR_BASE_URL=https://your-fhir-server
FHIR_CLIENT_ID=xxx
FHIR_CLIENT_SECRET=yyy
Policy Example
package axonflow.policy.healthcare
import future.keywords
# HIPAA minimum necessary rule
allow {
input.context.user_role in ["doctor", "nurse"]
is_patient_assigned_to_user(
input.context.user_id,
extract_patient_id(input.query)
)
}
# Emergency access (override with audit)
allow {
input.context.emergency_access == true
input.context.emergency_reason != ""
log_emergency_access
}
# Block access to all patient data (HIPAA violation)
deny["HIPAA violation: minimum necessary rule"] {
contains(lower(input.query), "all patients")
input.context.user_role != "admin"
}
# Redact SSN from queries
redacted_query := regex.replace(
input.query,
`\b\d{3}-\d{2}-\d{4}\b`,
"***-**-****"
)
Compliance Checklist
- ✅ Encryption at rest (AES-256)
- ✅ Encryption in transit (TLS 1.3)
- ✅ Access controls (RBAC)
- ✅ Audit logging (all PHI access)
- ✅ Data retention (6 years)
- ✅ Breach notification procedures
- ✅ Emergency access with audit trail
- ✅ Business Associate Agreement (BAA) with AxonFlow
GitHub
Documentation
E-commerce Recommendations
AI-powered product recommendation engine - Increase sales with personalized recommendations.
What It Demonstrates
- Product catalog integration
- Personalized recommendations
- Inventory management
- Price calculation with policies
- Cart management
- Order processing workflow
- A/B testing for recommendations
Features
✅ Recommendations:
- Collaborative filtering
- Content-based filtering
- Hybrid recommendations
- Real-time personalization
- Trending products
✅ Business Rules:
- Dynamic pricing policies
- Inventory constraints
- Discount rules
- Cross-sell/upsell logic
- Geo-specific pricing
✅ Performance:
- Sub-10ms recommendation latency
- Real-time inventory checks
- Cached product data
- Batch processing for analytics
Use Cases
-
Product Page Recommendations
- "Customers who bought this also bought..."
- "Similar products you might like"
- "Complete the look"
-
Cart Recommendations
- "Frequently bought together"
- "Add these items to save more"
- "Don't forget..."
-
Personalized Homepage
- Based on browsing history
- Based on purchase history
- Trending in your area
-
Email Campaigns
- Abandoned cart recovery
- Product recommendations
- Back-in-stock alerts
Architecture
Quick Start
cd examples/ecommerce-recommendations
# Setup
npm install
docker-compose up -d
# Run
npm run dev
# Access at http://localhost:3000
Policy Example
package axonflow.policy.ecommerce
# Dynamic pricing based on user tier
apply_discount {
input.context.user_tier == "premium"
input.product.price_with_discount := input.product.price * 0.9
}
apply_discount {
input.context.user_tier == "gold"
input.product.price_with_discount := input.product.price * 0.85
}
# Geo-specific pricing
apply_geo_pricing {
input.context.country == "US"
input.product.price_usd := input.product.base_price
}
apply_geo_pricing {
input.context.country == "EU"
input.product.price_eur := input.product.base_price * 0.92
}
# Block out-of-stock recommendations
deny["Product out of stock"] {
input.product.inventory_count <= 0
}
GitHub
Documentation
Customer Support
Complete Community demo - AI governance for customer support with PII protection and RBAC.
Runnable Example: This is a fully-functional demo included in the Community repository. Clone and run with
docker-compose up.
What It Demonstrates
- PII Detection & Redaction (SSNs, credit cards, phone numbers)
- Role-Based Access Control (agents, managers, admins)
- Policy Enforcement (SQL injection prevention)
- Audit Logging (complete data access trail)
- LLM Integration (natural language to SQL)
Features
✅ Governance:
- Automatic SSN/credit card redaction
- Role-based PII visibility
- SQL injection blocking
- Dangerous query prevention
✅ RBAC:
- Agent: Limited PII, regional access
- Manager: Full PII, escalation handling
- Admin: Global access, system admin
✅ Audit:
- Complete query logging
- User action tracking
- Policy violation recording
- Compliance reporting
Demo Scenarios
-
Agent Query (PII Redaction)
- Login as support agent
- Query customer data
- See SSNs automatically redacted
-
Manager Query (Full Access)
- Login as manager
- Query same data
- See full PII (role-based)
-
SQL Injection Prevention
- Try malicious query:
DROP TABLE users; - Query blocked by policy
- Try malicious query:
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ React Frontend │────▶│ Go Backend │────▶│ PostgreSQL │
│ (Port 3000) │ │ (Port 8080) │ │ (Port 5432) │
└─────────────────┘ └────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ AxonFlow Policy │────▶│ LLM APIs │
│ Engine │ │ (OpenAI/Claude) │
└─────────────────┘ └─────────────────┘
Quick Start
# Clone Community repository
git clone https://github.com/getaxonflow/axonflow.git
cd axonflow/platform/examples/support-demo
# Set API key
export OPENAI_API_KEY=sk-your-key
# OR
export ANTHROPIC_API_KEY=sk-ant-your-key
# Start
docker-compose up -d
# Access at http://localhost:3000
Demo Users
| Role | Password | |
|---|---|---|
| [email protected] | Agent | demo123 |
| [email protected] | Manager | demo123 |
| [email protected] | Admin | demo123 |
Policy Example
package axonflow.policy.support
# Redact SSN for non-managers
redacted_query := regex.replace(
input.query,
`\b\d{3}-\d{2}-\d{4}\b`,
"***-**-****"
) {
input.context.user_role != "manager"
input.context.user_role != "admin"
}
# Block SQL injection
deny["SQL injection blocked"] {
contains(upper(input.query), "DROP TABLE")
}
deny["SQL injection blocked"] {
contains(upper(input.query), "DELETE FROM")
}
GitHub
Documentation
Trip Planner
AI-powered travel planning assistant - Multi-agent coordination with MCP connectors.
What It Demonstrates
- Multi-Agent Parallel (MAP) execution
- MCP connector integration (Amadeus)
- LLM integration (Claude)
- Real-time flight/hotel search
- Itinerary generation
- Rate limiting patterns
- Service identity & permissions
Features
✅ Travel Planning:
- Flight search (Amadeus API)
- Hotel recommendations
- Activity suggestions
- Weather forecasts
- Restaurant recommendations
- Complete itinerary generation
✅ Performance:
- 5x faster with parallel execution
- Sub-10ms policy enforcement
- Real-time availability
- Cached results
✅ Advanced Patterns:
- Service-based authentication
- MCP connector permissions
- Rate limiting (100/hour, 500/day)
- Graceful fallback (LLM)
- Multi-agent orchestration
Use Cases
-
Complete Trip Planning
- Search flights
- Find hotels
- Suggest activities
- Generate itinerary
- All in single request
-
Budget Optimization
- Compare flight prices
- Find best hotel deals
- Optimize for budget
- Suggest alternatives
-
Multi-City Trips
- Complex routing
- Multiple destinations
- Optimized connections
- Time zone handling
Architecture
Quick Start
cd examples/trip-planner
# Setup backend
cd backend
go mod download
go run main.go
# Setup frontend
cd frontend
npm install
npm run dev
# Access at http://localhost:3000
Service License Configuration
// Service identity with MCP permissions
const client = new AxonFlowClient({
endpoint: process.env.AXONFLOW_ENDPOINT,
licenseKey: process.env.SERVICE_LICENSE_KEY, // Service-specific key
organizationId: 'travel-agency',
serviceIdentity: {
name: 'trip-planner',
type: 'backend-service',
permissions: [
'mcp:amadeus:search_flights',
'mcp:amadeus:search_hotels',
'mcp:amadeus:lookup_airport'
]
}
});
Policy Example
package axonflow.policy.travel
# Allow service to access Amadeus API
allow {
input.service.name == "trip-planner"
input.service.permissions[_] == sprintf("mcp:amadeus:%s", [input.mcp.operation])
}
# Enforce rate limiting
deny["Rate limit exceeded"] {
request_count := count_requests_last_hour(input.service.name)
request_count > 100
}
# Budget validation
deny["Budget too low"] {
input.budget < 100
input.budget_type == "total"
}
Performance
Sequential Execution (traditional):
Flight search: 5s
Hotel search: 5s
Activities: 8s
Weather: 3s
Restaurants: 8s
Total: 29 seconds
Parallel Execution (MAP):
All 5 queries in parallel: 8s (max of all)
Speedup: 3.6x
GitHub
Documentation
Choosing the Right Example
By Industry
| Industry | Recommended Example | Key Features |
|---|---|---|
| Banking/Finance | Banking AI Assistant | RBI, PCI-DSS, fraud detection, PII |
| Healthcare | Healthcare Assistant | HIPAA, PII protection, RBAC |
| Retail/E-commerce | E-commerce Recommendations | Personalization, inventory, pricing |
| SaaS/Tech | Customer Support | Ticket automation, knowledge base |
| Travel | Trip Planner | MAP, MCP connectors, LLM |
By Complexity
Beginner: Start with Hello World, then try E-commerce or Customer Support
Intermediate: E-commerce Recommendations or Customer Support
Advanced: Banking AI Assistant, Healthcare Assistant, or Trip Planner (compliance, multi-agent, MCP)
By Features
Need MCP Connectors? → Trip Planner or Healthcare Assistant
Need Multi-Agent (MAP)? → Trip Planner
Need HIPAA Compliance? → Healthcare Assistant
Need RBI/PCI-DSS Compliance? → Banking AI Assistant
Need Fraud Detection? → Banking AI Assistant
Need LLM Integration? → Trip Planner or Customer Support
Running Examples Locally
Prerequisites
All examples require:
- AxonFlow deployed (see Getting Started)
- License key (from CloudFormation outputs)
- Node.js 18+ or Go 1.21+
General Steps
# 1. Clone repository
git clone https://github.com/axonflow/examples
cd examples/[example-name]
# 2. Configure environment
cp .env.example .env
# Edit .env with your credentials
# 3. Install dependencies
npm install # or go mod download
# 4. Run
npm start # or go run main.go
Contributing
We welcome contributions! See CONTRIBUTING.md
Adding a New Example
- Follow existing structure
- Include README with setup instructions
- Add .env.example file
- Include sample policies
- Add tests
- Update this overview page
Support
Questions about examples?
- Email: [email protected]
- GitHub Issues: https://github.com/axonflow/examples/issues
- Documentation: https://docs.getaxonflow.com
All examples tested with AxonFlow v1.0.12 - Last updated: December 5, 2025