{"id":48854874,"url":"https://github.com/tb8412/qae-langgraph-example","last_synced_at":"2026-05-01T12:00:37.843Z","repository":{"id":344986364,"uuid":"1183591245","full_name":"tb8412/qae-langgraph-example","owner":"tb8412","description":"QAE safety certification integrated into LangGraph agent workflows — certify tool calls before execution","archived":false,"fork":false,"pushed_at":"2026-03-16T20:07:24.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T19:48:21.852Z","etag":null,"topics":["agent-framework","ai-agents","ai-safety","autonomous-agents","certification","deterministic","langchain","langgraph","python","qae","risk-management","safety","tool-use"],"latest_commit_sha":null,"homepage":"https://qaesubstrate.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tb8412.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-16T19:02:53.000Z","updated_at":"2026-03-16T22:56:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tb8412/qae-langgraph-example","commit_stats":null,"previous_names":["tb8412/qae-langgraph-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tb8412/qae-langgraph-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tb8412%2Fqae-langgraph-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tb8412%2Fqae-langgraph-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tb8412%2Fqae-langgraph-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tb8412%2Fqae-langgraph-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tb8412","download_url":"https://codeload.github.com/tb8412/qae-langgraph-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tb8412%2Fqae-langgraph-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32495949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["agent-framework","ai-agents","ai-safety","autonomous-agents","certification","deterministic","langchain","langgraph","python","qae","risk-management","safety","tool-use"],"created_at":"2026-04-15T12:00:31.254Z","updated_at":"2026-05-01T12:00:37.795Z","avatar_url":"https://github.com/tb8412.png","language":"Python","funding_links":[],"categories":["🌟 Community Projects"],"sub_categories":["🛠️ Developer Tools"],"readme":"# QAE + LangGraph: Certified Agent Actions\n\nAdd deterministic safety certification to LangGraph agent workflows. This example demonstrates how to integrate the QAE safety kernel into a multi-step agent pipeline, certifying tool calls before execution and blocking/escalating unsafe actions.\n\n## Architecture\n\n```\nAgent State Graph\n    ↓\nPropose Tool Call (LLM)\n    ↓\nQAE Certification Node\n    ├─→ Extract state deltas from tool call\n    ├─→ Run through SafetyCertifier\n    └─→ Decision: Certified / CertifiedWithWarning / EscalateToHuman / Blocked\n    ↓\nExecute Tool (or pause/reject)\n    ↓\nObserve → Loop or Complete\n```\n\n## Quick Start\n\n1. **Install dependencies:**\n\n```bash\npip install -r requirements.txt\n```\n\n2. **Run the basic certified agent example:**\n\n```bash\npython -m src.certified_agent\n```\n\nExpected output: Agent proposes a tool call, QAE certifies it, and displays the certificate decision.\n\n3. **Run the custom domain adapter example:**\n\n```bash\npython -m src.custom_domain_example\n```\n\nDemonstrates how to create domain-specific constraint channels.\n\n## What's Inside\n\n- **`src/certified_agent.py`** — LangGraph state graph with QAE certification node\n- **`src/custom_domain_example.py`** — Custom DomainAdapter and ConstraintChannel subclasses\n- **`requirements.txt`** — Python dependencies\n\n## Key Concepts\n\n### SafetyCertifier\n\nStateful certifier wrapping a DomainAdapter:\n\n```python\nfrom qae_safety import AgenticAdapter, SafetyCertifier, SimpleAction, StateDelta\n\nadapter = AgenticAdapter(budget_limit=100.0, rate_limit=50.0)\ncertifier = SafetyCertifier(adapter)\n\naction = SimpleAction(\n    action_id=\"tool-call-1\",\n    agent_id=\"agent-1\",\n    state_deltas=[\n        StateDelta(dimension=\"scope_score\", from_value=1.0, to_value=0.8),\n    ]\n)\n\ncert = certifier.certify(action)\nprint(f\"Decision: {cert.decision}\")\nprint(f\"Zone: {cert.zone}\")\nprint(f\"Margins: {cert.margins}\")\n```\n\n### Decision Zones\n\n| Margin Range | Zone | Decision | Action |\n|-------------|------|----------|--------|\n| \u003e 0.6 | Safe | Certified | Execute immediately |\n| (0.3, 0.6] | Caution | CertifiedWithWarning | Execute with logs/warnings |\n| (0.1, 0.3] | Danger | EscalateToHuman | Pause for human review |\n| ≤ 0.1 | Danger | Blocked | Reject |\n\n### Custom Domain Adapters\n\nExtend the safety kernel for your domain:\n\n```python\nfrom qae_safety import DomainAdapter, ConstraintChannel\n\nclass MyConstraint(ConstraintChannel):\n    def name(self):\n        return \"my_constraint\"\n\n    def evaluate(self, state):\n        # Return margin in [0, 1]\n        return 0.75\n\n    def dimension_names(self):\n        return [\"my_dimension\"]\n\nclass MyAdapter(DomainAdapter):\n    def domain_name(self):\n        return \"my_domain\"\n\n    def constraint_channels(self):\n        return [MyConstraint()]\n\n    def map_action_to_state(self, action):\n        return [1.0]\n\n    def detect_regime_change(self, current, proposed):\n        return False\n```\n\n## Research\n\nFor the theory behind QAE, see:\n\n- **Paper**: \"Deterministic Portfolio Risk Certification\" (DOI: [10.6084/m9.figshare.31742857](https://doi.org/10.6084/m9.figshare.31742857))\n- **Website**: [qaesubstrate.com](https://qaesubstrate.com)\n\n## License\n\nThis example is provided as part of the QAE project. See `LICENSE` in the root repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftb8412%2Fqae-langgraph-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftb8412%2Fqae-langgraph-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftb8412%2Fqae-langgraph-example/lists"}