Template Examples & Gallery

Explore real-world agent template examples. Copy, modify, and customize these templates for your specific document processing needs.

🚀 Quick Start

Copy any template below and customize it for your needs:

# 1. Copy a template
cp -r ./templates/invoice-processor ./agents/custom/my-invoice-processor

# 2. Edit the manifest
vim ./agents/custom/my-invoice-processor/manifest.yml

# 3. Validate and test
doclayer agent validate ./agents/custom/my-invoice-processor/manifest.yml
doclayer agent test custom.my-invoice-processor --document sample.pdf

Template Gallery

Browse templates by complexity and use case:

Custom Invoice Processor

FinanceIntermediate

Extract and analyze invoice data with custom business rules

Features:

Tax validationVendor lookupApproval workflowCost analysis

Legal Contract Analyzer

LegalAdvanced

Comprehensive contract analysis with risk assessment

Features:

Risk analysisCompliance checkingTerm extractionLegal review

Research Paper Digest

ResearchIntermediate

Extract key insights from academic papers and research documents

Features:

Citation extractionKey findingsMethodology analysisImpact assessment

Simple Text Extractor

GeneralBeginner

Basic text extraction and summarization for any document type

Features:

Text extractionBasic summarizationKey pointsSimple analysis

Complete Template Examples

Detailed manifest examples with explanations:

Custom Invoice Processor

FinanceIntermediate Level

Extract and analyze invoice data with custom business rules

Key Features:

  • Tax validation
  • Vendor lookup
  • Approval workflow
  • Cost analysis

Manifest

apiVersion: agent.doclayer.ai/v1
kind: Agent
metadata:
  name: custom.invoice-processor
  displayName: Custom Invoice Processor
  version: 1.0.0
  description: Extract and analyze invoice data with custom business rules
  category: custom
  tags: [invoice, finance, custom, processing]

spec:
  framework: tinyagent
  model_id: mistral/mistral-large
  
  instructions: |
    You are a specialized invoice processor for [COMPANY_NAME].
    
    Your task is to extract and analyze invoice data according to our specific business requirements:
    - Extract vendor information, amounts, dates, and line items
    - Validate tax calculations and compliance
    - Check against our vendor database
    - Flag any anomalies or missing information
    - Provide approval recommendations
    
    Always maintain high accuracy and provide detailed reasoning for your analysis.

  models:
    llm:
      provider: mistral
      model: mistral-large
      description: "Main reasoning model for invoice analysis"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false
    
    ocr:
      provider: mistral
      model: mistral-ocr-latest
      description: "OCR for invoice text extraction"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false
    
    embeddings:
      provider: gemini
      model: gemini-embedding-exp-04-17
      description: "Vector embeddings for vendor matching"
      cost_multiplier: 0.8
      performance_tier: standard
      fallback_enabled: false

  graph:
    - id: extract_basic_info
      prompt: |
        Extract basic invoice information:
        - Invoice number and date
        - Vendor name and address
        - Total amount and currency
        - Payment terms
        - Tax information (VAT/GST numbers and amounts)
        
        Return as structured JSON with confidence scores.
    
    - id: extract_line_items
      prompt: |
        Extract detailed line items:
        - Item descriptions
        - Quantities and unit prices
        - Line totals
        - Tax rates per line
        - Product/service categories
        
        Validate calculations and flag any discrepancies.
    
    - id: validate_compliance
      prompt: |
        Validate invoice compliance:
        - Check required fields are present
        - Verify tax calculations
        - Validate vendor information
        - Check against company policies
        - Flag any compliance issues
        
        Provide detailed compliance report.
    
    - id: business_analysis
      prompt: |
        Perform business analysis:
        - Compare with historical data
        - Check vendor performance
        - Identify cost trends
        - Recommend approval status
        - Suggest process improvements
        
        Provide actionable business insights.

  tools:
    - name: vendor_lookup
      type: builtin
      description: "Look up vendor information in company database"
    
    - name: tax_calculator
      type: builtin
      description: "Calculate and validate tax amounts"
    
    - name: policy_checker
      type: builtin
      description: "Check against company policies and limits"

runtime:
  environment: production
  scaling:
    min_instances: 0
    max_instances: 10
  resources:
    memory: 1Gi
    cpu: 500m

Usage Tips

  • • Customize the instructions section for your specific use case
  • • Adjust model configurations based on your performance needs
  • • Modify the processing graph to match your workflow
  • • Test thoroughly with your document types before production use
  • • Consider cost multipliers when selecting models

Legal Contract Analyzer

LegalAdvanced Level

Comprehensive contract analysis with risk assessment

Key Features:

  • Risk analysis
  • Compliance checking
  • Term extraction
  • Legal review

Manifest

apiVersion: agent.doclayer.ai/v1
kind: Agent
metadata:
  name: custom.contract-analyzer
  displayName: Legal Contract Analyzer
  version: 1.0.0
  description: Comprehensive contract analysis with risk assessment
  category: custom
  tags: [contract, legal, analysis, risk]

spec:
  framework: tinyagent
  model_id: mistral/mistral-large
  
  instructions: |
    You are a specialized legal contract analyzer with expertise in:
    - Contract law and standard terms
    - Risk identification and assessment
    - Compliance verification
    - Legal document structure analysis
    
    Your analysis should be thorough, accurate, and provide actionable legal insights.

  models:
    llm:
      provider: mistral
      model: mistral-large
      description: "Main reasoning model for legal analysis"
      cost_multiplier: 1.2
      performance_tier: accurate
      fallback_enabled: false
    
    ocr:
      provider: mistral
      model: mistral-ocr-latest
      description: "OCR for contract text extraction"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false
    
    graph_extraction:
      provider: gemini
      model: gemini-2.5-flash
      description: "Extract legal entities and relationships"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false

  graph:
    - id: extract_parties
      prompt: |
        Extract contract parties and their roles:
        - Primary parties and their legal names
        - Secondary parties (guarantors, agents, etc.)
        - Party addresses and contact information
        - Legal entity types and jurisdictions
        
        Return structured data with party relationships.
    
    - id: extract_terms
      prompt: |
        Extract key contract terms:
        - Subject matter and scope
        - Performance obligations
        - Payment terms and schedules
        - Duration and termination clauses
        - Intellectual property provisions
        - Confidentiality and non-disclosure terms
        
        Organize by category with importance ratings.
    
    - id: risk_assessment
      prompt: |
        Perform comprehensive risk assessment:
        - Identify high-risk clauses
        - Flag unusual or non-standard terms
        - Assess liability and indemnification risks
        - Check for missing standard protections
        - Evaluate termination and breach provisions
        
        Provide risk scores and detailed explanations.
    
    - id: compliance_check
      prompt: |
        Check compliance requirements:
        - Regulatory compliance (industry-specific)
        - Data protection and privacy requirements
        - Export control and sanctions
        - Anti-corruption and ethics requirements
        - Employment law compliance
        
        Flag any compliance gaps or requirements.
    
    - id: legal_review
      prompt: |
        Provide legal review and recommendations:
        - Overall contract assessment
        - Key concerns and recommendations
        - Suggested modifications
        - Negotiation points
        - Legal precedents and standards
        
        Format for legal team review.

  tools:
    - name: legal_database
      type: builtin
      description: "Access legal standards and precedents"
    
    - name: compliance_checker
      type: builtin
      description: "Check against regulatory requirements"
    
    - name: risk_calculator
      type: builtin
      description: "Calculate risk scores and probabilities"

runtime:
  environment: production
  scaling:
    min_instances: 0
    max_instances: 5
  resources:
    memory: 1Gi
    cpu: 500m

Usage Tips

  • • Customize the instructions section for your specific use case
  • • Adjust model configurations based on your performance needs
  • • Modify the processing graph to match your workflow
  • • Test thoroughly with your document types before production use
  • • Consider cost multipliers when selecting models

Research Paper Digest

ResearchIntermediate Level

Extract key insights from academic papers and research documents

Key Features:

  • Citation extraction
  • Key findings
  • Methodology analysis
  • Impact assessment

Manifest

apiVersion: agent.doclayer.ai/v1
kind: Agent
metadata:
  name: custom.research-digest
  displayName: Research Paper Digest
  version: 1.0.0
  description: Extract key insights from academic papers and research documents
  category: custom
  tags: [research, academic, analysis, digest]

spec:
  framework: tinyagent
  model_id: mistral/mistral-large
  
  instructions: |
    You are a specialized research paper analyzer with expertise in:
    - Academic writing and structure
    - Research methodology evaluation
    - Scientific data interpretation
    - Citation and reference analysis
    
    Provide clear, accurate summaries suitable for researchers and decision-makers.

  models:
    llm:
      provider: mistral
      model: mistral-large
      description: "Main reasoning model for research analysis"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false
    
    ocr:
      provider: mistral
      model: mistral-ocr-latest
      description: "OCR for research paper text extraction"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false
    
    embeddings:
      provider: gemini
      model: gemini-embedding-exp-04-17
      description: "Vector embeddings for similarity analysis"
      cost_multiplier: 0.8
      performance_tier: standard
      fallback_enabled: false

  graph:
    - id: extract_metadata
      prompt: |
        Extract paper metadata:
        - Title and authors
        - Publication venue and date
        - Abstract and keywords
        - DOI and citation information
        - Research field and subject area
        
        Return structured metadata with confidence scores.
    
    - id: analyze_methodology
      prompt: |
        Analyze research methodology:
        - Research approach and design
        - Data collection methods
        - Analysis techniques used
        - Sample size and characteristics
        - Limitations and constraints
        
        Assess methodology quality and appropriateness.
    
    - id: extract_findings
      prompt: |
        Extract key research findings:
        - Main research questions addressed
        - Primary findings and results
        - Statistical significance and effect sizes
        - Unexpected or surprising results
        - Implications and conclusions
        
        Organize findings by importance and novelty.
    
    - id: analyze_citations
      prompt: |
        Analyze citations and references:
        - Key cited works and their relevance
        - Citation patterns and trends
        - Missing important references
        - Citation quality and authority
        - Related work and context
        
        Provide citation analysis and recommendations.
    
    - id: generate_digest
      prompt: |
        Generate comprehensive research digest:
        - Executive summary
        - Key findings and insights
        - Methodology assessment
        - Strengths and limitations
        - Practical implications
        - Future research directions
        
        Format for both technical and non-technical audiences.

  tools:
    - name: citation_analyzer
      type: builtin
      description: "Analyze citation patterns and quality"
    
    - name: methodology_evaluator
      type: builtin
      description: "Evaluate research methodology quality"
    
    - name: impact_assessor
      type: builtin
      description: "Assess research impact and significance"

runtime:
  environment: production
  scaling:
    min_instances: 0
    max_instances: 5
  resources:
    memory: 512Mi
    cpu: 200m

Usage Tips

  • • Customize the instructions section for your specific use case
  • • Adjust model configurations based on your performance needs
  • • Modify the processing graph to match your workflow
  • • Test thoroughly with your document types before production use
  • • Consider cost multipliers when selecting models

Simple Text Extractor

GeneralBeginner Level

Basic text extraction and summarization for any document type

Key Features:

  • Text extraction
  • Basic summarization
  • Key points
  • Simple analysis

Manifest

apiVersion: agent.doclayer.ai/v1
kind: Agent
metadata:
  name: custom.text-extractor
  displayName: Simple Text Extractor
  version: 1.0.0
  description: Basic text extraction and summarization for any document type
  category: custom
  tags: [text, extraction, summary, general]

spec:
  framework: tinyagent
  model_id: mistral/mistral-large
  
  instructions: |
    You are a general-purpose text analyzer. Your task is to:
    - Extract key information from any document type
    - Provide clear, concise summaries
    - Identify important points and themes
    - Maintain accuracy and objectivity
    
    Adapt your analysis to the document type and content.

  models:
    llm:
      provider: mistral
      model: mistral-large
      description: "Main reasoning model for text analysis"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false
    
    ocr:
      provider: mistral
      model: mistral-ocr-latest
      description: "OCR for document text extraction"
      cost_multiplier: 1.0
      performance_tier: standard
      fallback_enabled: false

  graph:
    - id: extract_text
      prompt: |
        Extract and clean the document text:
        - Remove formatting artifacts
        - Preserve important structure
        - Identify document sections
        - Extract main content
        
        Return clean, structured text.
    
    - id: identify_key_points
      prompt: |
        Identify key points and themes:
        - Main topics and subjects
        - Important facts and figures
        - Key dates and names
        - Primary arguments or conclusions
        
        Organize by importance and relevance.
    
    - id: generate_summary
      prompt: |
        Generate a comprehensive summary:
        - Document overview
        - Key points and findings
        - Important details
        - Main conclusions
        
        Keep summary clear and concise.

  tools:
    - name: text_processor
      type: builtin
      description: "Process and clean document text"

runtime:
  environment: production
  scaling:
    min_instances: 0
    max_instances: 10
  resources:
    memory: 256Mi
    cpu: 100m

Usage Tips

  • • Customize the instructions section for your specific use case
  • • Adjust model configurations based on your performance needs
  • • Modify the processing graph to match your workflow
  • • Test thoroughly with your document types before production use
  • • Consider cost multipliers when selecting models

Template Categories

Organize templates by use case and complexity:

🏢 Business Documents

  • • Invoice Processing
  • • Contract Analysis
  • • Financial Reports
  • • Compliance Documents
  • • Policy Analysis

Legal Documents

  • • Contract Review
  • • Legal Briefs
  • • Compliance Checking
  • • Case Law Analysis
  • • Regulatory Documents

Research & Academic

  • • Research Papers
  • • Academic Articles
  • • Technical Documentation
  • • Literature Reviews
  • • Patent Analysis

Complexity Levels

Choose templates based on your experience level:

Beginner

Simple templates with basic functionality. Perfect for getting started.

  • • Basic text extraction
  • • Simple summarization
  • • Minimal configuration
  • • Easy to understand

Intermediate

Moderate complexity with multiple processing steps and custom logic.

  • • Multiple processing steps
  • • Custom business logic
  • • Tool integration
  • • Moderate configuration

Advanced

Complex templates with sophisticated analysis and multiple AI models.

  • • Complex analysis workflows
  • • Multiple AI models
  • • Advanced tool integration
  • • Extensive configuration

Creating Your Own Templates

Use these examples as starting points for your custom templates:

Step-by-Step Process

  1. 1
    Choose a Base Template: Start with a template that's similar to your use case
  2. 2
    Customize Instructions: Modify the instructions to match your specific requirements
  3. 3
    Adjust Processing Steps: Modify the graph to include your specific analysis steps
  4. 4
    Configure Models: Select appropriate AI models for your use case
  5. 5
    Test and Validate: Test your template with sample documents and validate the configuration

Best Practices

Do's

  • • Start simple and add complexity gradually
  • • Test with various document types
  • • Use clear, specific instructions
  • • Document your template's purpose
  • • Validate before production use
  • • Consider cost vs. performance trade-offs

Don'ts

  • • Don't skip validation steps
  • • Don't use overly complex prompts
  • • Don't ignore error handling
  • • Don't forget to test edge cases
  • • Don't use inappropriate models
  • • Don't skip documentation

Next Steps