Invoke agent flows from streamlit and apex app. #38
Invoke agent flows from streamlit and apex app. #38jrgauthier01 wants to merge 2 commits intomainfrom
Conversation
ahmedawan-oracle
left a comment
There was a problem hiding this comment.
PR Review
Solid sample code — the APEX plugin architecture (AQ-backed async processing, ownership validation, apex_escape.html() throughout) is production-quality. A few items to fix before merge:
Must Fix
1. ~15 DEBUG: print() statements left in aidp_chat.py
The StreamingResponse.__iter__ method is full of lines like:
print(f"DEBUG: Raw line: {decoded_line[:200]}")
print(f"DEBUG: Parsed chunk keys: {list(chunk_json.keys())}")
print(f"DEBUG: ✓ Yielding text chunk (length={len(text)})")These will spam server logs. Remove them or gate behind logging.DEBUG.
2. Init Client button is broken (aidp_streamlit_chat.py ~line 862)
if init_clicked:
st.session_state.messages = [...]
st.session_state.last_response_id = None
st.session_state.trace_history = []
st.rerun() # <-- halts execution here
ensure_client_ready() # <-- unreachablest.rerun() stops execution immediately, so ensure_client_ready() never runs. Move ensure_client_ready() before the st.rerun() call.
3. Refresh button is a no-op (aidp_streamlit_chat.py ~line 871)
if refresh_clicked:
print("Refresh")Either implement it or remove the button.
4. Placeholder URL never updated (aidp_streamlit_chat.py ~line 720)
📚 See [GETTING_STARTED.md](https://github.com/your-repo/blob/main/GETTING_STARTED.md) for detailed examples!
This is a literal your-repo placeholder — should point to the actual repo path.
Minor
aidp_chat.py:osimported twice (lines 1 & 8),List, Dict, Anyimported twice (lines 3 & 5)aidp_chat.py_post(): mutable default argumentheaders={"Content-Type":"application/json"}— useheaders=Nonewith assignment insiderequirements.txt:streamlit-authenticator>=0.3.2is listed but never imported anywherecreate_credential_and_profile.sql: no idempotency guard — re-running fails ifACP_CHAT_CREDalready existssummarize_conversation()AI prompt: typo "acronymm" (double m)
Description
two code samples to invoke agent flows from streamlit and apex. Those have been written by our engineering team.