Inspiration
Enterprise procurement and legal lifecycles are notorious bottlenecks. Finalizing a Statement of Work (SOW), issuing a Purchase Order (PO), and generating deposit invoices typically consumes weeks of manual redlining, rate reconciliation, and email ping-pong.
We were inspired by the Taskmaster challenge to move beyond conversational chatbots and build an autonomous, artifact-producing multi-agent workflow. Our goal was to simulate real-world B2B procurement where two sovereign enterprise entities—a Service Provider and an Enterprise Client—negotiate, enforce compliance, execute commitments, and reconcile financials with zero hallucinations.
What it does
PactFlow automates the entire B2B contract-to-cash lifecycle across strict organizational trust boundaries:
- Scope Ingestion & SOW Drafting: The Provider Intake Agent (Gemini 2.5 Flash) ingests project requirements, queries internal rate cards, and generates a structured SOW PDF artifact.
- Compliance Audit & Redlining: The Client Review Agent (Gemma 2 / Gemini) audits clauses against procurement policies (payment terms, IP assignment, liability caps) and produces structured redline deltas.
- Bounded Autonomous Negotiation: The agents execute up to 3 turns of automated concessions to resolve minor deltas before pausing for executive sign-off.
- Human-in-the-Loop (HITL) Gate: Stakeholders review side-by-side visual diffs and digitally authorize execution.
- PO Issuance: The Client PO Agent allocates internal budget and issues a formal Purchase Order record (
PO-XXXX.json). - Reconciliation & Billing: The Provider Billing Agent performs two-way matching ($\sum \text{Milestones} \equiv \text{PO Amount}$) and generates the initial commercial deposit invoice (
INV-XXXX.pdf). - Multimodal Kickoff Briefing: The Kickoff Agent triggers Google Veo to generate a dynamic 5-second video brief summarizing deliverables, budget, and timeline for leadership.
How we built it
- Multi-Agent Orchestration: Google Agent Development Kit (
google-adk) and Google GenAI SDK running on Google Cloud Run. - Heterogeneous Model Specialization:
- Gemini 2.5 Flash: Strategic orchestrator for SOW parsing, drafting, and reconciliation.
- Gemma 2: Sandboxed legal compliance clause auditor.
- Veo (Vertex AI): Multimodal executive project kickoff video generation.
- Neuro-Symbolic Verification Engine: Deterministic Python AST and arithmetic validation gates enforcing the invariant:
- Backend: Python 3.11+, FastAPI with Server-Sent Events (SSE) for real-time agent reasoning traces.
- Frontend: React 19, TypeScript, Tailwind CSS, Lucide icons, and dual-pane redline diff viewers.
- Document Engine & Storage: ReportLab for pixel-perfect SOW and Invoice PDF generation, backed by Google Cloud Storage.
Challenges we ran into
- Federated Multi-Party Trust Boundaries: Real enterprises cannot share a monolithic prompt memory. We had to enforce complete context isolation between Provider and Client pods, restricting inter-agent communication strictly to public, schema-validated JSON deltas.
- Eliminating Mathematical Drift: Early iterations saw LLMs introduce minor rounding discrepancies in milestone payment schedules. We solved this by implementing an AST neuro-symbolic validator that intercepts payloads and forces self-correction before state advancement.
- Asynchronous HITL Streaming: Synchronizing multi-agent execution with human interruptibility required an event-sourced state machine capable of time-travel rewind and checkpoint hot-reloading.
Accomplishments that we're proud of
- True Multi-Agent Isolation: Modeled sovereign organizational pods with zero memory leakage of private rate cards or budget ceilings.
- Zero-Hallucination Invariant: 100% mathematical consistency guaranteed across generated SOW PDFs, PO records, and Invoice documents.
- Full-Stack Serverless Deployment: Packaged the entire platform (FastAPI, React static assets, ADK agents, and PDF renderers) into a single container running seamlessly on Cloud Run.
What we learned
- Multi-agent architectures are vastly more effective when bounded by strict deterministic schemas and utility-scoring limits rather than open-ended dialogue loops.
- Model specialization (using lightweight models like Gemma for policy audits and Gemini Flash for orchestration) dramatically reduces latency and inference costs.
What's next for PactFlow
- Enterprise ERP Connectors: Native two-way integrations with SAP, Oracle NetSuite, and Coupa.
- Cryptographic Sign-off: Storing signed contract hashes and state transition proofs on decentralized ledgers for audit non-repudiation.
- Live Multimodal Negotiation Rooms: Interactive voice-enabled arbitration sessions between human procurement heads and autonomous agents.
Log in or sign up for Devpost to join the conversation.