Skip to main content

AI Agent

The AI Agent node provides a flexible framework for integrating AI language models into workflows, enabling intelligent processing of logistics documents, automated analysis, and AI-powered decision-making. Configure your preferred LLM provider and model to add artificial intelligence capabilities to any workflow.

Overview

The AI Agent node is essential when you need to:

  • Intelligent document processing - Extract structured data from unstructured logistics documents
  • Automated analysis - Analyze shipment data, identify patterns, and generate insights
  • Content generation - Create reports, summaries, and communications automatically
  • Decision support - Get AI recommendations for routing, pricing, and operations
  • Data classification - Categorize and tag logistics data intelligently
  • Exception handling - Analyze anomalies and suggest corrective actions

Video Overview

Configuration

LLM Provider Settings

Supported Providers

  • OpenAI - GPT-4, GPT-3.5-turbo, and other OpenAI models
  • Anthropic - Claude 3.5 Sonnet, Claude 3 Haiku, and Claude models
  • Google - Gemini Pro, Gemini Flash, and Vertex AI models
  • AWS Bedrock - Access to various foundation models through AWS
  • Ollama endpoints - Connect to self-hosted or private LLM deployments

Model Selection

  • Model name - Specify the exact model to use (e.g., "gpt-4", "claude-3-5-sonnet")
  • API credentials - Secure storage and management of API keys
  • Endpoint configuration - Custom API endpoints for private deployments

Prompt Configuration

System Prompt

  • Role definition - Define the AI agent's role and expertise area
  • Context setting - Provide background about logistics operations and requirements
  • Output format - Specify desired response structure and format
  • Constraints - Set boundaries and limitations for AI responses

User Prompt

  • Task description - Clear instructions for what the AI should accomplish
  • Dynamic content - Use workflow data in prompts with variable substitution
  • Examples - Provide sample inputs and expected outputs
  • Formatting requirements - Specify JSON, or other structured output formats

Context Properties

Data Context

  • Workflow data - Include relevant data from previous workflow nodes
  • Document content - Provide extracted text from PDFs or other documents
  • Historical data - Include relevant historical information for context
  • Reference data - Add lookup tables, codes, or reference information

Contextual Information

  • Business rules - Include company-specific policies and procedures
  • Regulatory requirements - Provide compliance and regulatory context
  • Performance metrics - Include KPIs and benchmarks for analysis
  • External data - Incorporate weather, traffic, or other external factors

Session Memory

Memory Configuration

  • Session tag - Unique identifier to group related AI agent executions
  • Persistent context - Maintain conversation history across multiple workflow steps

Memory Benefits

  • Contextual continuity - AI remembers previous interactions within the same session
  • Progressive analysis - Build upon previous AI responses for complex multi-step tasks
  • Conversation flow - Maintain natural dialogue across multiple workflow nodes
  • Learning from feedback - AI can reference corrections or clarifications from earlier steps

Example Usage & Common Use Cases

Bill of Lading Analysis

Document Processing:
PDF extraction → AI Agent → Structured data extraction

Configuration:
Provider: OpenAI
Model: gpt-4
System Prompt: "You are a logistics expert specializing in bill of lading analysis..."
User Prompt: "Extract key information from this BOL: {{pdfText}}"
Context: Company shipping codes, port mappings

Output: Structured JSON with shipper, consignee, cargo details, and routing information

Shipment Exception Analysis

Exception Handling:
Detect anomaly → AI Agent → Root cause analysis and recommendations

Configuration:
Provider: Anthropic
Model: claude-3-5-sonnet
System Prompt: "Analyze shipment exceptions and provide actionable recommendations..."
User Prompt: "Analyze this shipment delay: {{exceptionData}}"
Context: Historical performance data, carrier SLAs, weather conditions

Output: Root cause analysis with recommended actions and priority level

Customer Communication Generation

Communication Automation:
Shipment update → AI Agent → Personalized customer message

Configuration:
Provider: Google
Model: gemini-pro
System Prompt: "Generate professional customer communications for logistics updates..."
User Prompt: "Create update message for: {{shipmentStatus}}"
Context: Customer preferences, communication history, service level

Output: Personalized email or SMS content for customer notification

Route Optimization Analysis

Operational Intelligence:
Route data → AI Agent → Optimization recommendations

Configuration:
Provider: AWS Bedrock
Model: anthropic.claude-v2
System Prompt: "Provide route optimization recommendations based on logistics data..."
User Prompt: "Analyze these routes and suggest improvements: {{routeData}}"
Context: Traffic patterns, fuel costs, driver schedules, delivery windows

Output: Optimized route suggestions with cost and time savings estimates

Invoice Processing and Validation

Financial Document Processing:
Invoice text → AI Agent → Data extraction and validation

Configuration:
Provider: Azure OpenAI
Model: gpt-4
System Prompt: "Extract and validate invoice data for logistics services..."
User Prompt: "Process this invoice and flag any discrepancies: {{invoiceText}}"
Context: Rate cards, service agreements, historical pricing

Output: Structured invoice data with validation flags and discrepancy alerts

Regulatory Compliance Check

Compliance Automation:
Shipment details → AI Agent → Compliance verification

Configuration:
Provider: OpenAI
Model: gpt-4-turbo
System Prompt: "Verify logistics compliance with international shipping regulations..."
User Prompt: "Check compliance for shipment: {{shipmentDetails}}"
Context: Regulatory databases, restricted items lists, country-specific rules

Output: Compliance status with specific requirements and documentation needs

Multi-Document Analysis with Memory

Progressive Document Processing:
Document 1 → AI Agent → Document 2 → AI Agent → Summary

Configuration:
Provider: OpenAI
Model: gpt-4
Session Tag: "batch-analysis-{{workflowId}}"
System Prompt: "Analyze logistics documents and build comprehensive understanding..."

Step 1 - First Document:
User Prompt: "Analyze this BOL: {{document1Text}}"
Memory: Empty (first interaction)
Output: Initial shipment analysis

Step 2 - Additional Document:
User Prompt: "Now analyze this invoice: {{document2Text}}"
Memory: Contains BOL analysis
Output: Combined analysis referencing both documents

Step 3 - Final Summary:
User Prompt: "Generate comprehensive shipment summary"
Memory: Contains full document analysis history
Output: Complete shipment overview leveraging all analyzed documents

Progressive Exception Resolution

Multi-Stage Problem Solving:
Initial issue → Gather data → Analyze → Recommend solution

Configuration:
Session Tag: "exception-{{trackingNumber}}"

Stage 1 - Issue Identification:
User Prompt: "Analyze this shipment exception: {{exceptionData}}"
Memory: Empty
Output: Initial problem assessment

Stage 2 - Additional Context:
User Prompt: "Consider this additional data: {{carrierResponse}}, {{weatherInfo}}"
Memory: Contains initial assessment
Output: Updated analysis with new context

Stage 3 - Solution Recommendation:
User Prompt: "Provide final resolution recommendation"
Memory: Contains complete analysis history
Output: Comprehensive solution based on all gathered information

Advanced Features

Multi-Step Reasoning

  • Chain of thought - Enable step-by-step reasoning for complex problems
  • Iterative analysis - Process data through multiple AI reasoning steps
  • Validation loops - Use AI to verify and refine its own outputs
  • Confidence scoring - Get confidence levels for AI recommendations

Structured Output

  • JSON schema - Define exact output structure for consistent results
  • Data validation - Ensure AI outputs match expected formats
  • Type enforcement - Specify data types for extracted information
  • Required fields - Mark essential fields that must be populated

Context Management

  • Dynamic context - Adjust context based on workflow conditions
  • Context prioritization - Weight different context sources appropriately
  • Memory management - Handle large context efficiently within token limits
  • Context templates - Reuse common context patterns across workflows

Session Memory Management

  • Memory persistence - Maintain conversation history across workflow executions
  • Session grouping - Use session tags to group related AI interactions

Best Practices

Prompt Engineering

  • Clear instructions - Write specific, unambiguous prompts
  • Examples and templates - Provide sample inputs and expected outputs
  • Role definition - Clearly define the AI agent's expertise and perspective
  • Output format specification - Explicitly request structured output formats

Context Optimization

  • Relevant information - Include only pertinent context to avoid confusion
  • Structured context - Organize context logically with clear sections
  • Dynamic filtering - Adjust context based on specific use cases

Memory Management

  • Session design - Plan session boundaries for optimal memory usage
  • Session naming - Use descriptive session tags for easy identification

Model Selection

  • Task-appropriate models - Choose models suited for specific tasks
  • Cost optimization - Balance model capability with usage costs
  • Performance testing - Evaluate different models for your use cases
  • Fallback options - Configure backup models for reliability

Quality Assurance

  • Output validation - Verify AI responses meet quality standards
  • Human oversight - Implement review processes for critical decisions
  • Continuous monitoring - Track AI performance and accuracy over time
  • Feedback loops - Use results to improve prompts and context

Integration Patterns

With Document Processing

PDF Node → AI Agent (extract data) → Set Node (structure) → Database Update

With Decision Logic

Data Input → AI Agent (analyze) → If Node (act on recommendation) → Execute Action

With Loops

Document List → Loop → AI Agent (process each) → Collect Results → Summary

With External APIs

AI Agent (generate request) → HTTP Request → AI Agent (process response) → Final Output

Security & Compliance

Data Privacy

  • Data handling - Understand how LLM providers process your data

Compliance Considerations

  • Regulatory requirements - Ensure AI usage complies with industry regulations
  • Audit trails - Maintain logs of AI decisions and recommendations
  • Bias monitoring - Watch for and address potential AI bias or hallucinations in outputs
  • Explainability - Document AI decision-making processes for compliance

Troubleshooting

Common Issues

  • API errors - Verify credentials and endpoint configuration
  • Poor output quality - Refine prompts and provide better context
  • Inconsistent results - Add more specific instructions

Debugging Tips

  • Test with simple prompts - Start with basic requests before adding complexity
  • Monitor token usage - Track input and output token consumption
  • Validate context - Ensure context data is properly formatted and relevant
  • Compare models - Test different models to find optimal performance

Performance Optimization

  • Prompt efficiency - Minimize unnecessary words while maintaining clarity
  • Context pruning - Remove irrelevant information from context
  • Batch processing - Group similar requests when possible
  • Caching strategies - Cache common AI responses to reduce API calls

The AI Agent node brings the power of artificial intelligence to logistics workflows, enabling intelligent document processing, automated analysis, and AI-powered decision-making throughout your supply chain operations.