Skip to content

Invoke agent flows from streamlit and apex app. #38

Open
jrgauthier01 wants to merge 2 commits intomainfrom
jr-invoke
Open

Invoke agent flows from streamlit and apex app. #38
jrgauthier01 wants to merge 2 commits intomainfrom
jr-invoke

Conversation

@jrgauthier01
Copy link
Copy Markdown
Contributor

Description

two code samples to invoke agent flows from streamlit and apex. Those have been written by our engineering team.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 14, 2026
Copy link
Copy Markdown
Contributor

@ahmedawan-oracle ahmedawan-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()  # <-- unreachable

st.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: os imported twice (lines 1 & 8), List, Dict, Any imported twice (lines 3 & 5)
  • aidp_chat.py _post(): mutable default argument headers={"Content-Type":"application/json"} — use headers=None with assignment inside
  • requirements.txt: streamlit-authenticator>=0.3.2 is listed but never imported anywhere
  • create_credential_and_profile.sql: no idempotency guard — re-running fails if ACP_CHAT_CRED already exists
  • summarize_conversation() AI prompt: typo "acronymm" (double m)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants