Add model backend selector and Claude Agent SDK runner#42
Open
SakshiKekre wants to merge 13 commits intoPolicyEngine:mainfrom
Open
Add model backend selector and Claude Agent SDK runner#42SakshiKekre wants to merge 13 commits intoPolicyEngine:mainfrom
SakshiKekre wants to merge 13 commits intoPolicyEngine:mainfrom
Conversation
|
@SakshiKekre is attempting to deploy a commit to the PolicyEngine Team on Vercel. A member of the Team first needs to authorize it. |
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
/chat/backendsand a frontend Engine selector with backend package version displayrun_pythonexecution environments behind the backend registryPOLICYENGINE_CHAT_AGENT_RUNNER=claude_sdkrun_pythonto the SDK runner through an in-process MCP tool while preserving the existing frontend SSE event contractbackend/requirements.txtto avoid deployment dependency driftNotes
The existing direct Anthropic Messages loop remains the default unless
POLICYENGINE_CHAT_AGENT_RUNNER=claude_sdkis set. This lets us merge the backend selector work while keeping the SDK runner gated for comparison/testing.Validation
cd backend && ../.venv/bin/python -m py_compile routes/chatbot.py claude_agent_sdk_runner.py model_backends.py agent_tools.py ../modal_app.pycd backend && ../.venv/bin/python -m pytest tests/test_agent_tools.py tests/test_api.py::TestChatBackends::test_lists_backends tests/test_api.py::TestChatMessage::test_unknown_model_backend_returns_400cd frontend && npm run buildPOLICYENGINE_CHAT_AGENT_RUNNER=claude_sdk:chunkanddonetool_start,tool_use,tool_result, and finaldoneManual test
Default runner:
cd backend && set -a; source ../.env; set +a; ../.venv/bin/python -m uvicorn main:app --host 127.0.0.1 --port 8002SDK runner:
cd backend && set -a; source ../.env; set +a; POLICYENGINE_CHAT_AGENT_RUNNER=claude_sdk ../.venv/bin/python -m uvicorn main:app --host 127.0.0.1 --port 8001Frontend examples:
cd frontend && PORT=3001 BACKEND_URL=http://127.0.0.1:8002 npm run devfor default runnercd frontend && BACKEND_URL=http://127.0.0.1:8001 npm run devfor SDK runner