{"id":26421147,"url":"https://github.com/agentoverlay/ueta-agent-error-handling-demos","last_synced_at":"2025-03-18T02:04:14.305Z","repository":{"id":280101671,"uuid":"940929979","full_name":"agentoverlay/ueta-agent-error-handling-demos","owner":"agentoverlay","description":"Uniform Electronic Transactions Act based error handling agent demos. Collaboration between Andor Kesselman and Dazza Greenwood","archived":false,"fork":false,"pushed_at":"2025-03-03T07:55:09.000Z","size":89,"stargazers_count":3,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T13:02:08.181Z","etag":null,"topics":["agentic","agentic-ai","demo","electrontic-payments","legal-ai","transaction","ueta"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agentoverlay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-01T04:37:47.000Z","updated_at":"2025-03-03T08:35:10.000Z","dependencies_parsed_at":"2025-03-09T13:02:11.500Z","dependency_job_id":"188da101-aebe-4dc6-b5d2-7ae3bfba89c2","html_url":"https://github.com/agentoverlay/ueta-agent-error-handling-demos","commit_stats":null,"previous_names":["madesm/ueta-agent-error-handling-demos","agentoverlay/ueta-agent-error-handling-demos"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentoverlay%2Fueta-agent-error-handling-demos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentoverlay%2Fueta-agent-error-handling-demos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentoverlay%2Fueta-agent-error-handling-demos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentoverlay%2Fueta-agent-error-handling-demos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agentoverlay","download_url":"https://codeload.github.com/agentoverlay/ueta-agent-error-handling-demos/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244141539,"owners_count":20404836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic","agentic-ai","demo","electrontic-payments","legal-ai","transaction","ueta"],"created_at":"2025-03-18T02:01:25.721Z","updated_at":"2025-03-18T02:04:14.281Z","avatar_url":"https://github.com/agentoverlay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UETA Agent -- Goods Producer Demo\n\nThis repository showcases how AI-driven agents can integrate with legal frameworks and electronic transactions in the context of a modern goods producer. Inspired by Section 10 of the UETA (Uniform Electronic Transactions Act), the demo features a business API that offers a product catalog and processes orders, while both an autonomous agent (with a dashboard) and a human operator (with a separate dashboard) can interact with transactions. The system emphasizes robust error handling, auditability, and progressive confirmation of transactions—occasionally requiring manual approval (with a 1/10 probability for agent orders) before orders are finalized.\n\nDeveloped in collaboration between Dazza Greenwood and Andor Kesselman, this project builds on the insights presented in [UETA and LLM Agents: A Deep Dive into Legal Error Handling](https://www.dazzagreenwood.com/p/ueta-and-llm-agents-a-deep-dive-into). In that article, the author explores the challenges and opportunities in merging AI-assisted legal processes with electronic transactions, including transparency, accountability, and the need for clear error correction workflows. This demo reflects those principles, integrating technical and legal nuances to simulate a secure and auditable digital commerce system.\n\n## 📌 Overview\n\nThis repository contains demos that illustrate several aspects of AI-assisted legal transactions and goods ordering:\n\n- **Product Catalog and Order Processing**  \n  - The business API acts as a goods producer, providing a catalog of products (SKU, description, and price) and processing orders from users and agents.\n- **Error Simulation and Approval**  \n  - An optional error simulation mode (activated with a flag) randomly fails approximately 10% of orders. Additionally, agent orders have a 1/10 chance of requiring manual approval before being finalized.\n- **User Wallet and Order Transactions**  \n  - Users (or agents) maintain a digital wallet. Orders deduct funds from the wallet based on product prices.\n- **Autonomous Agent with Dashboard**  \n  - An agent mode automatically places random orders and also provides a dashboard to view pending (i.e. pre-approved) transactions.\n- **Human Intervention Dashboard**  \n  - A separate human service provides a dashboard where flagged orders are listed, allowing a human operator to approve pending transactions or revert error orders.\n\n## Features\n\n* **Audit Tracing** — If `auditableLog` is set to true, both the producer and consumer maintain logs to mitigate liability.\n* **Progressive Confirmation** — When enabled (via config or random chance for agent orders), transactions are held pending approval.\n* **Dashboards for Agents and Humans** — Agents can view their pending orders via a dedicated dashboard, while human operators can review and act on flagged transactions.\n\n### Roadmap\n\n* Enhanced Progressive Confirmation\n* Improved Detection Mechanisms\n* Error Correction Workflows\n* System State Tracking\n* Support for Two- and Three-Party Agreements\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n [Node.js](https://nodejs.org/) (version 14 or later)\n- [pnpm](https://pnpm.io/)\n\n## Demo\n\n**Work in progress**  \n![Demo Screenshot](https://github.com/user-attachments/assets/9e15e422-682c-4942-8566-c19ddcc0087d)\n\n## Installation\n\n1. Clone the repository.\n2. Install dependencies by running:\n\n   ```bash\n   pnpm install\n   ```\n\n## Running the Application\n\n### 1. Start the Business API\n\nThe business API simulates a goods producer by offering a product catalog and processing orders on port **4000**.\n\n- **Normal mode:**\n\n  ```bash\n  pnpm run start:seller\n  ```\n\n- **Error simulation mode:** (Approximately 10% of orders will trigger a simulated error or require approval)\n\n  ```bash\n  pnpm run start:seller -- --with-error\n  ```\n\n### 2. Use the Agent CLI \u0026 Dashboard\n\nThe agent CLI lets you create an account with a wallet, list available products, place orders (with a 1/10 probability that approval is required), and run autonomous agent mode. A dashboard is also available to view pending orders for your account.\n\n#### a. Create an Account\n\nThis command creates a new account with a wallet. Each new agent starts with a balance of 1000. You can also deduct an initial deposit (default: 100) if desired.\n\n- **Default deposit:**\n\n  ```bash\n  pnpm run start:agent create-account\n  ```\n\n- **Custom deposit (e.g., 200):**\n\n  ```bash\n  pnpm run start:agent create-account -- --deposit 200\n  ```\n\n#### b. List Available Products\n\nDisplay the product catalog from the business API:\n\n```bash\npnpm run start:agent list-products\n```\n\n#### c. Place an Order\n\nSubmit an order by specifying the product SKU and quantity. Use the `--agent` flag to indicate the order is placed by the agent. For example, to order 2 units of the product with SKU `SKU001`:\n\n```bash\npnpm run start:agent order -- --sku SKU001 --quantity 2 --agent\n```\n\n#### d. Start Autonomous Agent Mode\n\nLaunch autonomous agent mode, which automatically places random orders at random intervals:\n\n```bash\npnpm run start:agent agent\n```\n\n#### e. Launch the Agent Dashboard\n\nView pending (pre-approved) orders for your account via a dashboard. By default, the dashboard runs on port **6001**:\n\n```bash\npnpm run start:agent dashboard\n```\n\n\u003cimg width=\"1785\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f2b7b947-5dec-48d3-83b8-e94a208ac317\" /\u003e\n\n### 3. Use the Human Intervention Dashboard\n\nThe human service provides a dashboard (accessible via a web browser) where flagged orders are listed. Here, a human operator can:\n- **Approve** pending transactions (moving them from `pending_confirmation` to `delivered`).\n- **Revert** orders that encountered errors.\n\nThe human service listens on a configurable port (default **5002**). To change it, set the environment variable `HUMAN_PORT`.\n\nTo start the human service:\n\n```bash\npnpm run start:human\n```\n\nThen, access the dashboard at:  \n```\nhttp://localhost:5002/dashboard\n```\n\n\u003cimg width=\"1785\" alt=\"image\" src=\"https://github.com/user-attachments/assets/80196682-4ab5-42f0-a1f9-49c00eedebd0\" /\u003e\n\n\n### 4. Viewing Order Logs\n\nLogs for both the business and agent sides are maintained (if enabled via `auditableLog`) to support audit tracing and error correction.\n\n## Project Structure\n\n- **business.ts**  \n  The business API server simulates a goods producer. It maintains a product catalog, processes orders (with optional error simulation and approval requirements), and logs transaction statuses.\n- **agent.ts**  \n  The agent CLI tool allows account creation, wallet management, product listing, order placement, autonomous order placement, and includes a dashboard for viewing pending orders.\n- **human.ts**  \n  The human service provides a dashboard for reviewing flagged orders and supports approving or reverting transactions.\n- **config.ts**  \n  Contains configuration settings that control logging, progressive confirmation, and monitoring.\n- **package.json**  \n  Contains project scripts and dependencies.\n\n## License\n\nThis project is provided as-is under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentoverlay%2Fueta-agent-error-handling-demos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagentoverlay%2Fueta-agent-error-handling-demos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentoverlay%2Fueta-agent-error-handling-demos/lists"}