Inspiration Foxit’s challenge posed an undeniable truth: Your agent shouldn't sign that. An autonomous LLM has no legal identity, and a single hallucinated liability clause can cost a company millions. Because we fundamentally don't trust AI to execute high-stakes actions, contracts still die in the manual handoff. An AI can draft an agreement in seconds, but a human still spends days reading it, verifying limits, and manually orchestrating the signature.

We realized the problem isn't the AI's ability to draft; the problem is the consequence boundary. We wanted to build a system that bridged this gap—allowing organizations to turn messy, everyday communication into legally signed outcomes in minutes, without ever handing actual legal autonomy to an LLM.

What it does Mandate Gate is an AI-powered contract execution system that shifts AI from autonomous execution to Delegated Authority.

Users don't need to fill out rigid forms; they prompt the system with messy, multi-modal data (like voice notes or chat streams). The system extracts the legal intent, drafts the contract, and evaluates it through two independent gates before execution:

The Deterministic Gate: Policy-as-code mathematically verifies structured data (like contract values or dates) against the user's pre-approved "Master Mandate."

The Adversarial Gate: An isolated Auditor Agent red-teams the unstructured text to catch hallucinations or unauthorized legal liabilities.

If the document fails either gate, it safely halts and routes to a human-in-the-loop. But if both gates approve it, Mandate Gate seamlessly hands the document over to the Foxit eSign API to automatically apply the authorized signature.

How we built it We built the orchestration layer using LangGraph and a FastAPI backend to strictly control the state machine of the agents.

Drafting: The primary agent uses the Foxit MCP Server tools to assemble, format, and generate a clean PDF draft based on the user's prompt.

Extraction & Structuring: We used structured outputs (Pydantic) to force the LLM to extract key variables (like max_amount or party_name) into a strict JSON schema.

Verification: The structured data is evaluated deterministically. Simultaneously, the free-text sections are passed to a secondary, isolated LLM—the Auditor Agent—prompted specifically to destroy and invalidate the first agent's work.

Execution: Once the state machine registers a PASS from both gates, the backend packages the approved PDF and a cryptographic audit trail, securely calling the Foxit eSign API to execute the signature.

Challenges we ran into Our biggest hurdle was figuring out how to deterministically verify a document that contains unpredictable free text.

Initially, we tried using Regex and rigid JSON schemas to verify what the LLM drafted. We quickly realized this is fundamentally incapable of acting as a legal gatekeeper. Regex can verify that an invoice is under $500, but it cannot verify if an agent silently rewrote an indemnification clause on page three. We had to invent the Adversarial Gate—a multi-agent red-teaming approach—to create a semantic filter strong enough to catch dangerous free text without defaulting every single document to a human.

Accomplishments that we're proud of We successfully engineered Programmable Trust. We solved the core paradox of the challenge: giving an AI execution agency without giving it legal liability. By heavily isolating the generation layer from the execution layer, we proved that you can safely give AI the keys to an eSign API, provided you build an unbreakable mathematical lock around when it can use them.

What we learned We learned that the true value of Agentic AI isn't in letting it run wild with total autonomy. The most powerful AI systems are those bounded by strict, deterministic guardrails. We also learned that to trust an AI to write a contract, you must employ a separate AI to aggressively audit it.

What's next for Mandate gate Our next step is building a Semantic Indexing Engine for enterprise use. Instead of the Drafting Agent generating custom clauses, it will retrieve pre-approved corporate legal boilerplate from a vector database. We also plan to integrate with enterprise identity providers (SSO/OAuth) so that Master Mandate delegation tokens can be minted and revoked dynamically based on a user's role within an organization.

Built With

  • fastapi
  • foxit-esign-api
  • foxit-mcp
  • langgraph
  • open-policy-agent
  • pydantic
  • python
  • react
Share this project:

Updates

Submission history