|
| 1 | +import os |
| 2 | + |
| 3 | +from crewai import Agent, Crew, Task |
| 4 | +from nutrient_dws import NutrientClient |
| 5 | + |
| 6 | + |
| 7 | +client = NutrientClient(api_key=os.getenv("NUTRIENT_API_KEY", "nutr_sk_placeholder")) |
| 8 | + |
| 9 | + |
| 10 | +document_planner = Agent( |
| 11 | + role="Document Workflow Planner", |
| 12 | + goal="Design a robust Nutrient DWS processing pipeline for incoming files.", |
| 13 | + backstory="You optimize OCR, extraction, and redaction workflows for accuracy." |
| 14 | +) |
| 15 | + |
| 16 | +document_reviewer = Agent( |
| 17 | + role="Document QA Reviewer", |
| 18 | + goal="Review proposed workflow plans for failure modes and compliance risks.", |
| 19 | + backstory="You specialize in validating document automation quality." |
| 20 | +) |
| 21 | + |
| 22 | +plan_task = Task( |
| 23 | + description=( |
| 24 | + "Design a pipeline for ./examples/assets/sample.pdf that extracts text, " |
| 25 | + "redacts emails, and exports a cleaned PDF." |
| 26 | + ), |
| 27 | + expected_output="A numbered execution plan with tool calls.", |
| 28 | + agent=document_planner, |
| 29 | +) |
| 30 | + |
| 31 | +review_task = Task( |
| 32 | + description=( |
| 33 | + "Review the proposed pipeline. Flag risks and add fallback handling steps." |
| 34 | + ), |
| 35 | + expected_output="Risk review with concrete mitigations.", |
| 36 | + agent=document_reviewer, |
| 37 | +) |
| 38 | + |
| 39 | +crew = Crew( |
| 40 | + agents=[document_planner, document_reviewer], |
| 41 | + tasks=[plan_task, review_task], |
| 42 | + verbose=True, |
| 43 | +) |
| 44 | + |
| 45 | + |
| 46 | +if __name__ == "__main__": |
| 47 | + # Keep a direct client reference so users see where DWS calls happen. |
| 48 | + print(f"Client configured: {bool(client)}") |
| 49 | + print(crew.kickoff()) |
0 commit comments