import time, sys from crewai import Agent, Task, Crew, LLM model = sys.argv[1] llm = LLM(model=f"ollama/{model}", base_url="http://localhost:11434", temperature=0) csv = open("invoices.csv").read() clerk = Agent(role="UK bookkeeping assistant", goal="Prepare accurate credit-control summaries for a UK small business", backstory="You help a small UK firm chase unpaid invoices. UK standard VAT rate is 20%.", llm=llm, verbose=True) t = Task(description=f"Today is 2026-10-14. All invoices below are unpaid. Data:\n{csv}\n" "1) For each invoice compute VAT at 20% and gross total (GBP, 2dp). 2) List which invoices are overdue (due date before today). " "3) Give the total gross amount overdue. 4) Draft a short, polite UK-English chaser email to the customer with the oldest overdue invoice.", expected_output="A table of invoices with net, VAT, gross; the overdue list; total gross overdue; a chaser email.", agent=clerk) s=time.time(); out = Crew(agents=[clerk], tasks=[t]).kickoff(); print("\n=====FINAL=====\n", out.raw); print(f"\nELAPSED {time.time()-s:.1f}s")