{"id":50818108,"url":"https://github.com/ericchansen/ai-xml","last_synced_at":"2026-06-13T11:04:32.957Z","repository":{"id":361543558,"uuid":"1146357381","full_name":"ericchansen/ai-xml","owner":"ericchansen","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-19T16:59:58.000Z","size":2236,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-31T06:27:50.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericchansen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-31T01:01:26.000Z","updated_at":"2026-02-19T17:00:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ericchansen/ai-xml","commit_stats":null,"previous_names":["ericchansen/ai-xml"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ericchansen/ai-xml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchansen%2Fai-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchansen%2Fai-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchansen%2Fai-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchansen%2Fai-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericchansen","download_url":"https://codeload.github.com/ericchansen/ai-xml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchansen%2Fai-xml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34281700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-06-13T11:04:32.228Z","updated_at":"2026-06-13T11:04:32.952Z","avatar_url":"https://github.com/ericchansen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI-Assisted Workflow Authoring\n\n[![CI](https://github.com/ericchansen/ai-xml/actions/workflows/ci.yml/badge.svg)](https://github.com/ericchansen/ai-xml/actions/workflows/ci.yml)\n\nTransform natural language descriptions into valid **BPMN 2.0** or **WS-BPEL 2.0** XML using a sequential agent pipeline with iterative validation and repair.\n\n## 🚀 Quick Start\n\n```bash\n# Prerequisites: uv (https://docs.astral.sh/uv/), Azure CLI\n# Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh\n\n# 1. Clone and enter directory\ncd ai-xml\n\n# 2. Configure Azure OpenAI (copy and edit)\ncp .env.example .env\n# Edit .env with your Azure OpenAI endpoint\n\n# 3. Login to Azure\naz login\n\n# 4. Run the app\nuv run streamlit run app.py\n```\n\nThat's it! `uv` automatically creates a virtual environment and installs all dependencies.\n\n## 🧪 Running Tests\n\n```bash\n# Run all tests\nuv run --group dev pytest tests/ -v\n\n# Run specific test file\nuv run --group dev pytest tests/test_validation.py -v\n\n# Run with coverage (if installed)\nuv run --group dev pytest tests/ --cov=src\n```\n\n## 🎯 Problem Statement\n\nEnterprise integration platforms require deep platform expertise to author integrations. Users must translate business scenarios into detailed process graphs and XML definitions through manual, error-prone steps. LLMs lack native understanding of custom XML grammars and semantic constraints.\n\n**Solution:** An AI-assisted authoring approach that bridges business intent to valid workflow artifacts, preserving correctness, debuggability, and human control through validation and iterative correction.\n\n## 🏗️ Architecture\n\nThis project implements the **Sequential Orchestration Pattern** from [Microsoft's AI Agent Design Patterns](https://learn.microsoft.com/en-us/agent-framework/user-guide/workflows/orchestrations/sequential):\n\n```mermaid\nflowchart LR\n    subgraph Input\n        A[👤 User Prompt]\n    end\n    \n    subgraph Pipeline [\"Sequential Agent Pipeline\"]\n        B[🧠 Intent Parser\u003cbr/\u003eNL → JSON]\n        C[📝 Schema Generator\u003cbr/\u003eJSON → XML]\n        D{✅ Validator\u003cbr/\u003eXSD + Semantic}\n        E[🔧 Repair Agent\u003cbr/\u003eFix Errors]\n    end\n    \n    subgraph Output\n        F[📄 BPMN 2.0\u003cbr/\u003eor BPEL 2.0]\n    end\n    \n    A --\u003e B\n    B --\u003e C\n    C --\u003e D\n    D --\u003e|Valid| F\n    D --\u003e|Invalid| E\n    E --\u003e|Retry ≤3| C\n    E --\u003e|Max Retries| F\n    \n    style B fill:#e1f5fe\n    style C fill:#fff3e0\n    style D fill:#e8f5e9\n    style E fill:#fce4ec\n```\n\n### Pipeline Stages\n\n1. **Intent Parser** - Converts natural language to structured JSON workflow spec\n2. **Schema Generator** - Transforms JSON to BPMN 2.0 or WS-BPEL 2.0 XML\n3. **Validator** - XSD validation + semantic checks (reachability, completeness)\n4. **Repair Agent** - LLM-driven iterative error correction (max 3 attempts)\n\n## ⚙️ Configuration\n\nCopy `.env.example` to `.env` and configure:\n\n```bash\n# Azure OpenAI (recommended)\nAZURE_OPENAI_ENDPOINT=https://your-resource.cognitiveservices.azure.com/\nAZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o-mini\nAZURE_OPENAI_API_VERSION=2024-12-01-preview\n```\n\nAuthentication uses `DefaultAzureCredential` - just run `az login` before starting the app.\n\n## 📁 Project Structure\n\n```\nai-xml/\n├── app.py                      # Streamlit demo UI\n├── pyproject.toml              # Project metadata and dependencies\n├── .env.example                # Environment variable template\n├── src/\n│   ├── __init__.py\n│   ├── models.py               # Pydantic models for workflow representation\n│   ├── prompts.py              # Agent system prompts\n│   ├── validation.py           # XML validation utilities (lxml)\n│   ├── pipeline.py             # Microsoft Agent Framework pipeline\n│   └── langgraph_pipeline.py   # LangGraph comparison implementation\n├── schemas/\n│   ├── bpmn20-simplified.xsd   # BPMN 2.0 schema for validation\n│   └── bpel20-simplified.xsd   # WS-BPEL 2.0 schema for validation\n└── examples/\n    ├── order-processing.bpmn   # Example BPMN output\n    └── order-processing.bpel   # Example BPEL output\n```\n\n## 🔧 Key Design Decisions\n\n### 1. Intermediate JSON Representation\n\nInstead of generating XML directly from natural language, we use a simplified JSON schema:\n\n```json\n{\n  \"workflow\": {\n    \"name\": \"OrderProcessing\",\n    \"activities\": [\n      {\"id\": \"start\", \"type\": \"startEvent\"},\n      {\"id\": \"validateOrder\", \"type\": \"serviceTask\", \"operation\": \"validateOrder\"},\n      {\"id\": \"end\", \"type\": \"endEvent\"}\n    ],\n    \"flows\": [\n      {\"from\": \"start\", \"to\": \"validateOrder\"},\n      {\"from\": \"validateOrder\", \"to\": \"end\"}\n    ]\n  }\n}\n```\n\n**Benefits:**\n- Reduces LLM hallucination\n- Easier to validate before XML generation\n- Decouples intent understanding from XML syntax\n\n### 2. Iterative Validation \u0026 Repair\n\n- XSD validation catches structural errors\n- Semantic validation checks workflow correctness (reachability, completeness)\n- Repair loop limited to 3 iterations to prevent infinite loops\n- Errors surfaced to user if repair fails\n\n### 3. Human-in-the-Loop\n\n- All intermediate steps visible in the UI\n- Users can download and manually edit results\n- Clear error messages with suggested fixes\n\n## 📊 Framework Comparison\n\n| Aspect | Microsoft Agent Framework | LangGraph |\n|--------|--------------------------|-----------|\n| State | Pydantic models | TypedDict |\n| Control flow | Manual loops | Graph edges |\n| Backend | Azure AI, GitHub Copilot | OpenAI/Anthropic |\n| Enterprise | Azure integration | General purpose |\n\nSee `src/langgraph_pipeline.py` for the LangGraph implementation.\n\n## 📚 References\n\n- [AI Agent Orchestration Patterns (Microsoft)](https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/ai-agent-design-patterns)\n- [Microsoft Agent Framework Quick-Start](https://learn.microsoft.com/en-us/agent-framework/tutorials/quick-start)\n- [GitHub Copilot Agents](https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-types/github-copilot-agent)\n- [BPMN 2.0 Specification](https://www.omg.org/spec/BPMN/2.0/)\n- [WS-BPEL 2.0 Specification](https://docs.oasis-open.org/wsbpel/2.0/wsbpel-v2.0.html)\n\n### Related Academic Work\n- [arXiv:2509.24592](https://arxiv.org/abs/2509.24592) - AI-assisted workflow generation\n- [Springer Chapter](https://link.springer.com/chapter/10.1007/978-3-031-81375-7_27) - Hybrid workflow authoring\n- [CEUR-WS Paper](https://ceur-ws.org/Vol-4099/ER25_PAD_Costa.pdf) - Iterative validation patterns\n- [gpt-codegen](https://github.com/RobJenks/gpt-codegen) - LLM code generation patterns\n\n## 📝 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericchansen%2Fai-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericchansen%2Fai-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericchansen%2Fai-xml/lists"}