1- """Demo endpoint for AI-powered policy analysis.
1+ """Agent endpoint for AI-powered policy analysis.
22
33This endpoint lets users ask natural language questions about tax/benefit policy
44and get AI-generated reports using Claude Code connected to the PolicyEngine MCP server.
1616
1717from policyengine_api .config import settings
1818
19- router = APIRouter (prefix = "/demo " , tags = ["demo " ])
19+ router = APIRouter (prefix = "/agent " , tags = ["agent " ])
2020
2121
2222class AskRequest (BaseModel ):
@@ -33,7 +33,7 @@ class AskResponse(BaseModel):
3333
3434
3535class JobStatusResponse (BaseModel ):
36- """Status of a demo job."""
36+ """Status of an agent job."""
3737
3838 job_id : str
3939 status : str
@@ -87,7 +87,7 @@ async def _stream_claude_code(question: str, api_base_url: str):
8787async def _stream_modal_sandbox (question : str , api_base_url : str ):
8888 """Stream output from Claude Code running in Modal Sandbox."""
8989
90- from policyengine_api .demo_sandbox import run_claude_code_in_sandbox
90+ from policyengine_api .agent_sandbox import run_claude_code_in_sandbox
9191
9292 sb , process = run_claude_code_in_sandbox (question , api_base_url )
9393
@@ -129,7 +129,7 @@ async def stream_analysis(request: AskRequest):
129129 """
130130 api_base_url = settings .policyengine_api_url
131131
132- if settings .demo_use_modal :
132+ if settings .agent_use_modal :
133133 return StreamingResponse (
134134 _stream_modal_sandbox (request .question , api_base_url ),
135135 media_type = "text/event-stream" ,
@@ -145,8 +145,8 @@ async def stream_analysis(request: AskRequest):
145145async def ask_question (request : AskRequest ) -> AskResponse :
146146 """Ask a policy question (non-streaming).
147147
148- Starts the analysis in the background. Poll GET /demo /status/{job_id} for results.
149- For real-time streaming, use POST /demo /stream instead.
148+ Starts the analysis in the background. Poll GET /agent /status/{job_id} for results.
149+ For real-time streaming, use POST /agent /stream instead.
150150 """
151151 job_id = str (uuid4 ())
152152 api_base_url = settings .policyengine_api_url
@@ -162,7 +162,7 @@ async def ask_question(request: AskRequest) -> AskResponse:
162162 async def run_job ():
163163 _jobs [job_id ]["status" ] = "running"
164164 try :
165- if settings .demo_use_modal :
165+ if settings .agent_use_modal :
166166 import modal
167167
168168 run_policy_analysis = modal .Function .lookup (
@@ -203,7 +203,7 @@ async def run_job():
203203
204204@router .get ("/status/{job_id}" , response_model = JobStatusResponse )
205205async def get_job_status (job_id : str ) -> JobStatusResponse :
206- """Get the status of a demo job."""
206+ """Get the status of an agent job."""
207207 if job_id not in _jobs :
208208 raise HTTPException (status_code = 404 , detail = "Job not found" )
209209
0 commit comments