[codex] add python sdk examples - #18
Merged
Merged
Conversation
|
✅ Clean PR, @calvin-archastro! No blocking findings on
Reply |
calvin-archastro
marked this pull request as ready for review
June 12, 2026 21:37
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.
What changed
Adds three public Python SDK examples with focused test coverage:
examples/org_system_user_token: shows how an ArchAgents org-owned system user can use the SDK with onlyARCHASTRO_ACCESS_TOKEN. The README covers sync and async client setup, the ArchAgentsarchagentpath, developer bootstrap witharchastro, and token rotation.examples/create_agent_cli: shows a small sync CLI wrapper aroundPlatformClient.with_token(...)for creating an agent.examples/thread_chat_tui: shows a basic curses chat UI for an existing thread usingAsyncPlatformClient.open_socket(...)and generated chat channel helpers.Updates the root README with a public getting-started flow for ArchAgents use cases, including system-user token setup, sync
PlatformClientusage, asyncAsyncPlatformClientusage, developer app auth, and links to the examples.The TUI keeps websocket operations in
ThreadChatSessionand terminal rendering/input inThreadChatTui, so the SDK usage remains visible without coupling curses UI code directly to generated channel calls.CI now includes
tests/examplesin the unit-test slice, and the root README documents how to run those example tests locally.Diagrams
sequenceDiagram participant Operator as SDK user participant CLI as create agent example participant SyncClient as PlatformClient participant API as production API gateway Operator->>CLI: run with name identity and env tokens CLI->>SyncClient: with_token using API key and access token SyncClient->>API: POST create agent API-->>SyncClient: created agent payload SyncClient-->>CLI: agent data CLI-->>Operator: print JSON resultsequenceDiagram participant User as terminal user participant TUI as ThreadChatTui participant Session as ThreadChatSession participant AsyncClient as AsyncPlatformClient participant Channel as ApiChatChannel participant API as production API gateway User->>TUI: type message and press Enter TUI->>Session: send_message with idempotency key Session->>Channel: api_chat_post_simple_message Channel->>API: websocket push API-->>Channel: ok reply Channel-->>Session: reply Session-->>TUI: send complete TUI-->>User: show Message sentclassDiagram class PlatformClient { +with_token(api_key access_token base_url) +agents +users } class AsyncPlatformClient { +open_socket(url) +users } class ThreadChatSession { +on_message_added(callback) +load_history() +send_message(content idempotency_key) +close() } class ThreadChatTui { +add_history(messages) +add_message_payload(payload) +run() } class ApiChatChannel { +join_user_thread(socket thread_id) +join_team_thread(socket team_id thread_id) +api_chat_list_messages(payload) +api_chat_post_simple_message(payload) +leave() } PlatformClient ..> API : sync REST AsyncPlatformClient ..> ApiChatChannel : opens socket for ThreadChatSession ..> ApiChatChannel : wraps ThreadChatTui ..> ThreadChatSession : usesScope indicator
SDK docs, examples, and CI only. No generated SDK runtime files or backend/frontend application code changed.
Risk assessment
Low risk. This adds opt-in example scripts and tests, plus includes those tests in the existing CI unit-test command. The only runtime-adjacent change is example code under
examples/.User impact
SDK users get a root README quickstart for ArchAgents system-user use cases plus runnable examples for common usage patterns: system-user auth, sync REST calls, async REST calls, creating agents from a CLI, and websocket chat in a terminal UI.
Testing
Automated checks run locally:
uv run ruff checkuv run ruff format --checkuv run pytest tests/examples -p no:cacheproviderwith12 passeduv run pytest tests/test_http_client.py src/archastro/phx_channel/tests/test_unit.py tests/examples -p no:cacheproviderwith63 passedManual/local smoke checks performed against the local platform before opening this PR:
agi_033XIHg5RXvKReEbG8kxnsand CLI readback matched the returned payload.msg_033XIPDIpEosVpdUMA5Eqpthrough the real curses UI and CLI readback found the message in the thread.Follow-ups and known issues
No known issues. The example docs avoid internal service names and only mention production defaults plus public local or non-production override behavior.