feat(examples): add Azure AI Foundry + LangGraph example#132
Open
abhinav-galileo wants to merge 10 commits intomainfrom
Open
feat(examples): add Azure AI Foundry + LangGraph example#132abhinav-galileo wants to merge 10 commits intomainfrom
abhinav-galileo wants to merge 10 commits intomainfrom
Conversation
Customer support agent deployed on Azure AI Foundry Hosted Agents, governed by Agent Control at runtime. Demonstrates step-specific controls (pre/post), runtime toggle from the UI, and defense-in-depth across tool and LLM boundaries.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Replace hardcoded Agent Control server IP with ${AGENT_CONTROL_URL}
env var placeholder in agent.yaml
- Remove pyproject.toml since requirements.txt is sufficient for this
flat example (used by both Dockerfile and local setup)
- Rewrite deploy section with actual step-by-step azd commands - Add section for deploying to existing Foundry project - Add Agent Control VM deployment instructions - Document gotchas (pip upgrade, .dockerignore, DB reset, policy refresh) - Add .dockerignore to exclude .venv from container builds - Add azd infra (Bicep templates from azd-ai-starter-basic) - Add azure.yaml service definition - Fix local_test.py to use new simplified tool API - Add load_dotenv() to entry scripts for .env support
…y example - Eliminate module-level shared state in graph.py that raced under concurrent requests; pass messages as params, return response directly - Use ainvoke() instead of sync invoke() to avoid blocking the event loop - Switch tools.py to checked-wrapper pattern so @control() sees .name at registration time and correctly classifies steps as type="tool" - Fix seed_controls.py 409 handler to filter by name and handle missing controls instead of raising StopIteration on paginated results - Align .env.example model name with agent.yaml and settings.py - Add AGENT_CONTROL_API_KEY to agent.yaml environment variables - Remove duplicate env var resolution in model.py - Add example to examples/README.md index table
…resh - Add DEMO_SCRIPT.md with step-by-step walkthrough - Switch control execution from server to sdk (lower latency) - Reduce policy refresh interval from 5s to 2s for snappier demos - Link demo script from README
Leak, block, toggle. Removed repetitive per-control walkthrough.
…s, JS-safe regex - Add 5th control (block-pii-in-response) on llm_call post for defense in depth - catches PII in LLM output even if tool leaked it earlier - Add explicit step_types (llm/tool) to all control scopes - Replace (?i) with [Xx] case alternation for JS regex compatibility in the Agent Control UI
- Add SSN to customer PII mock data
- Replace block-customer-pii + block-pii-in-response with single
block-pii control targeting both lookup_customer_pii and llm_call
- Simpler regex (\d{3}-\d{2}-\d{4}) everyone recognizes
- Update demo script to focus on SSN flow
- Add process_refund tool with @control() - Add max-refund-amount control using JSON evaluator with field_constraints (refund_amount max: 100) instead of regex - proper numeric comparison - Merge lookup_customer tools into single tool with SSN - Simplify to single customer (Jane Doe), single order (ORD-1001) - Update demo script with two flows: PII protection + refund limits
…ompat The JSON evaluator needs valid JSON input. The @control() decorator stringifies dict output with Python repr (single quotes), which breaks JSON parsing. Returning json.dumps() from the tool ensures the evaluator can parse the refund_amount field for numeric constraint checking. Also fix stray text in seed_controls.py from clipboard paste.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/azure_foundry_langgraph/demonstrating Agent Control governing a LangGraph agent deployed on Azure AI Foundry Hosted Agents@control()Demo flow
Test plan
python seed_controls.pycreates controls on a running Agent Control serverpython local_test.pypasses against a local serverazd deploybuilds and deploys to Azure AI Foundry Hosted Agents