Skip to content

Dana Recipes - Agent-Native Convergence Patterns

Real-world solutions demonstrating the convergence of AI development assistance with autonomous execution using Dana's agent-native architecture and OpenDXA


Quick Navigation

🚀 Getting Started

🏗️ Convergence Application Patterns

🤖 Multi-Agent Systems

📚 Advanced Agent-Native Convergence Patterns


Recipe Categories

Agent-Native Programming Patterns

Write agents as first-class primitives with context-aware intelligence:

# Traditional approach: Static classes
class CustomerAnalyzer:
    def assess_risk(self, customer):
        return static_analysis(customer)

# Convergence approach: Adaptive agent with context-aware execution
agent CustomerAnalyzer:
    def assess_risk(self, customer):
        # Context-aware execution - same reasoning, different output types
        risk_score: float = reason("assess customer risk", context=customer)
        risk_details: dict = reason("assess customer risk", context=customer)
        return risk_score, risk_details  # Function learns via POET

Data Modeling & Business Logic

Use Dana's agent-native struct system to model your domain clearly and add AI-powered behavior:

struct Customer:
    id: str
    name: str
    email: str
    status: str

def analyze_engagement(customer: Customer) -> str:
    return reason("Analyze customer engagement patterns", context=customer)

# Method syntax sugar makes it natural
customer = Customer(id="C001", name="Alice", email="alice@example.com", status="active")
engagement = customer.analyze_engagement()

This recipe is not available.

Self-Improving Pipeline Patterns

Compositional operations that optimize themselves through POET:

# Traditional pipeline: Manual orchestration
def process_data(data):
    step1_result = analyze(data)
    step2_result = filter(step1_result) 
    step3_result = transform(step2_result)
    return step3_result

# Convergence pipeline: Self-improving composition
data | analyze | filter | transform  # Each stage learns and optimizes via POET

Context-Aware Execution Patterns

Intelligence that adapts output types based on usage context:

# Same reasoning adapts to what you need
customer_insights: dict = reason("analyze customer behavior", context=customer_data)
customer_score: float = reason("analyze customer behavior", context=customer_data)
customer_report: str = reason("analyze customer behavior", context=customer_data)

AI Integration Patterns

Seamlessly integrate AI reasoning into your application logic using agent-native features:

# Document analysis
def extract_insights(doc: Document) -> dict:
    key_points = reason("Extract key points", context=doc.content)
    sentiment = reason("Analyze sentiment", context=doc.content) 
    return {"points": key_points, "sentiment": sentiment}

# Risk assessment
def assess_portfolio_risk(portfolio: Portfolio) -> str:
    return reason("Assess investment risk", context=portfolio.positions)

Configuration & Error Handling

Build robust, maintainable applications with proper configuration management:

struct AppConfig:
    database_url: str
    api_key: str
    debug_mode: bool

def validate_config(config: AppConfig) -> bool:
    if not config.api_key:
        log("API key is required", level="error")
        return false
    return true

Performance Patterns

Understand Dana's performance characteristics and optimize when needed:

  • Struct Creation: ~0.7x overhead (actually faster than Python dicts!)
  • Method Calls: ~4x overhead (acceptable for added functionality)
  • Field Access: ~9x overhead (cache frequently accessed data)

How to Use These Recipes

1. Start with Your Use Case

Each recipe is self-contained and includes: - Problem Statement: What you're trying to solve - Complete Working Code: Copy-paste ready examples - Explanation: Why the pattern works - Variations: How to adapt for your needs

2. Copy and Adapt

All examples are designed to be: - Copy-paste ready: Working code you can use immediately - Well-documented: Clear explanations of each part - Extensible: Easy to modify for your specific requirements

3. Build on Patterns

Start with simple patterns and combine them: - Use struct patterns for data modeling - Add AI integration for intelligent behavior - Apply configuration patterns for maintainability - Implement error handling for robustness


Recipe Index

Business Applications

Recipe Use Case Complexity

Data Processing

Recipe Use Case Complexity

System Patterns

Recipe Use Case Complexity

Multi-Agent Systems

Recipe Use Case Complexity

Integration

Recipe Use Case Complexity
API Clients REST API integration Beginner
MCP Services Model Context Protocol Intermediate

Contributing Recipes

Have a useful pattern or example? We'd love to include it!

Recipe Template

Each recipe should include:

  1. Problem Statement - What real-world problem does this solve?
  2. Complete Example - Working, copy-paste ready code
  3. Explanation - Step-by-step breakdown
  4. Variations - Common adaptations
  5. Best Practices - Do's and don'ts
  6. Performance Notes - Any performance considerations

Submission Process

  1. Follow the template structure
  2. Test all code examples
  3. Include clear documentation
  4. Submit via pull request

Getting Help

Quick Reference

Community


Next Steps

  1. Start Simple: Pick a recipe that matches your use case
  2. Experiment: Modify examples to fit your needs
  3. Build: Combine patterns for larger applications
  4. Share: Contribute back patterns you find useful

Copyright © 2025 Aitomatic, Inc. Licensed under the MIT License.
https://aitomatic.com