Quick Start - Agentic AI Process Automation
Get started with autonomous process agents in 5 minutes!
๐ Installationโ
1. Install Dependenciesโ
pip install -r requirements.txt
2. Set API Keys (Optional)โ
export OPENAI_API_KEY="your-key-here"
๐งพ Invoice Processing Agentโ
Run Demoโ
python examples/process_automation/invoice_processing_demo.py
Use in Codeโ
from packages.agents.process_agents import InvoiceProcessingAgent
# Initialize
agent = InvoiceProcessingAgent()
# Process invoice
result = await agent.process_invoice("path/to/invoice.pdf")
# Check result
if result.approval_decision.approved:
# Auto-approved!
print(f"โ Approved: ${result.invoice_data.total_amount}")
else:
# Route for approval
print(f"โ Route to: {result.approval_decision.escalation_level}")
Configurationโ
validator_config = {
"auto_approve_threshold": 1000.00,
"approved_vendors": ["Acme Corp", "Global Supplies"]
}
router_config = {
"auto_approve_limit": 1000.00,
"supervisor_limit": 5000.00,
"manager_limit": 25000.00
}
agent = InvoiceProcessingAgent(
validator_config=validator_config,
router_config=router_config
)
๐ง Email Response Agentโ
Run Demoโ
python examples/process_automation/email_response_demo.py
Use in Codeโ
from packages.agents.process_agents import EmailResponseAgent, Email
from datetime import datetime
# Initialize
agent = EmailResponseAgent()
# Create email
email = Email(
email_id="email-001",
from_address="customer@example.com",
to_address="support@company.com",
subject="How do I reset my password?",
body="I can't login to my account...",
received_at=datetime.utcnow()
)
# Process email
result = await agent.process_email(email)
# Check result
if result.auto_send:
print(f"โ Auto-sent: {result.draft.subject}")
else:
print(f"โ Requires approval: {result.classification.category}")
With RAG Contextโ
# Add retriever for context
from packages.rag.retrievers import HybridRetriever
agent = EmailResponseAgent(retriever=your_retriever)
# Now drafts will include KB context
result = await agent.process_email(email)
๐ Research & Report Agentโ
Run Demoโ
python examples/process_automation/research_report_demo.py
Use in Codeโ
from packages.agents.process_agents import ResearchAgent, ReportFormat
# Initialize
agent = ResearchAgent()
# Conduct research
result = await agent.conduct_research(
research_question="What are AI trends in healthcare?",
output_format=ReportFormat.MARKDOWN
)
# Access report
print(f"Title: {result.report.title}")
print(f"Summary: {result.report.executive_summary[:200]}...")
# Save report
agent.report_generator.save_report(
result.report,
"outputs/research_report.md"
)
With Custom Contextโ
# Add context to guide research
context = {
"focus": "enterprise_adoption",
"industry": "healthcare",
"timeframe": "2024-2025"
}
result = await agent.conduct_research(
research_question="What are AI trends in healthcare?",
context=context
)
๐ Multi-Agent Workflowโ
Combine Multiple Agentsโ
from packages.agents.process_agents import (
InvoiceProcessingAgent,
EmailResponseAgent,
ResearchAgent
)
# Initialize all agents
invoice_agent = InvoiceProcessingAgent()
email_agent = EmailResponseAgent()
research_agent = ResearchAgent()
# Workflow: Process invoice โ Research vendor โ Send email
async def invoice_verification_workflow(invoice_pdf, vendor_query):
# Step 1: Process invoice
invoice_result = await invoice_agent.process_invoice(invoice_pdf)
# Step 2: Research vendor if unknown
if not invoice_result.validation_result.vendor_approved:
research_result = await research_agent.conduct_research(
f"Research vendor: {invoice_result.invoice_data.vendor_name}"
)
# Step 3: Send notification email
email = create_notification_email(invoice_result)
email_result = await email_agent.process_email(email)
return {
"invoice": invoice_result,
"research": research_result,
"notification": email_result
}
โ๏ธ Configuration Optionsโ
Invoice Agentโ
config = {
# Validator
"validator_config": {
"auto_approve_threshold": 1000.00,
"max_invoice_age_days": 90,
"require_po_above": 5000.00,
"approved_vendors": ["Vendor1", "Vendor2"]
},
# Router
"router_config": {
"auto_approve_limit": 1000.00,
"supervisor_limit": 5000.00,
"manager_limit": 25000.00,
"auto_approve_enabled": True
}
}
Email Agentโ
config = {
# Classifier
"classifier_config": {
"model": "gpt-4o-mini",
"temperature": 0,
"enable_pii_detection": True
},
# Drafter
"drafter_config": {
"model": "gpt-4o",
"temperature": 0.3,
"templates_path": "path/to/templates.json"
}
}
Research Agentโ
config = {
# Planner
"planner_config": {
"model": "gpt-4o",
"max_sub_questions": 7
},
# Gatherer
"gatherer_config": {
"enable_web_search": True,
"enable_internal_search": True
},
# Generator
"generator_config": {
"default_format": "markdown"
}
}
๐ Performance Expectationsโ
Processing Timesโ
Agent | Task | Time | Cost |
---|---|---|---|
Invoice | Process 1 invoice | 4-6s | $0.002 |
Draft 1 response | 4-6s | $0.004 | |
Research | Generate 1 report | 40-55s | $0.03-0.05 |
Automation Ratesโ
Agent | Auto-Handle | Manual Review | Escalation |
---|---|---|---|
Invoice | 70% | 25% | 5% |
75% | 20% | 5% | |
Research | 100% | 0% | 0% |
๐งช Testingโ
Run Unit Testsโ
# All tests
pytest tests/process_agents/ -v
# Specific agent
pytest tests/process_agents/test_invoice_agent.py -v
# With coverage
pytest tests/process_agents/ --cov=packages.agents.process_agents
๐ Next Stepsโ
1. Try the Demosโ
Run all three demos to see the agents in action.
2. Review Documentationโ
- Week 1 Complete - Invoice
- Week 2 Complete - Email
- Week 3 Complete - Research
3. Customize for Your Needsโ
- Modify business rules in config files
- Add custom templates
- Integrate with your data sources
4. Deploy to Productionโ
- Add your own PDF invoices
- Connect to your email system
- Integrate with your knowledge base
๐ก Common Use Casesโ
Finance Operationsโ
# Automate invoice processing
agent = InvoiceProcessingAgent()
for invoice_file in pending_invoices:
result = await agent.process_invoice(invoice_file)
if result.approval_decision.approved:
process_payment(result)
else:
send_for_approval(result)
Customer Supportโ
# Automate email responses
agent = EmailResponseAgent(retriever=kb_retriever)
for email in inbox:
result = await agent.process_email(email)
if result.auto_send:
send_email(result.draft)
else:
queue_for_review(result)
Business Intelligenceโ
# Automate research reports
agent = ResearchAgent(retriever=docs_retriever)
result = await agent.conduct_research(
"Market analysis for Q4 2025"
)
agent.report_generator.save_report(result.report, "q4_analysis.md")
๐ง Troubleshootingโ
Import Errorsโ
# If you get import errors, ensure project root is in path
import sys
from pathlib import Path
project_root = Path(__file__).parent.parent.parent
sys.path.insert(0, str(project_root))
API Key Not Setโ
# Set OpenAI API key
export OPENAI_API_KEY="your-key"
# Or use .env file
echo "OPENAI_API_KEY=your-key" > .env
PDF Parsing Issuesโ
# Install pdfplumber if missing
pip install pdfplumber>=0.10.3
๐ Supportโ
- Documentation:
/docs/docs/services/agentic-process-automation/
- Examples:
/examples/process_automation/
- Tests:
/tests/process_agents/
- Code:
/packages/agents/process_agents/
Ready to build AI employees! ๐ค๐