Current section

Files

Jump to
codex_sdk docs 20251202 python-parity 009-migration-plan.md
Raw

docs/20251202/python-parity/009-migration-plan.md

Plan
- Implement agent/run surface: add `Agent`/`RunConfig` equivalents, multi-turn loop, handoffs, tool_use_behavior, guardrails, and session hooks. Owner: Elixir SDK core. Tests: port `tests/test_run.py`, `tests/test_max_turns.py`, guardrail suites; integrate with existing `test/codex/thread_auto_run_test.exs`. Fixtures: synthetic models or codex mocks to simulate tool calls/handoffs.
- Tooling parity: add function_tool wrapper, structured tool outputs, hosted tool configs (file/web search, shell, apply_patch, computer, image/code interpreter), and tool guardrails. Owner: Tools/Integrations. Tests: port `tests/test_function_tool.py`, `tests/test_tool_output_conversion.py`, `tests/test_shell_tool.py`, `tests/test_apply_patch_tool.py`, `tests/test_computer_action.py`, `tests/test_tool_guardrails.py`. Fixtures: shell executor harness, apply_patch editor stub, computer mock.
- MCP integration: expand MCP client to list/call tools with filters, retries, approvals, and tracing; support hosted MCP tool config. Owner: MCP integration. Tests: mirror `tests/mcp/test_runner_calls_mcp.py`, `tests/mcp/test_tool_filtering.py`, `tests/mcp/test_client_session_retries.py`, `tests/mcp/test_mcp_tracing.py`. Fixtures: stub MCP servers (stdio/SSE/streamable HTTP) and approval callback harness.
- Attachments/files: map `Codex.Files` staging to Python-style input_file/image schema; add file search options. Owner: Files/IO. Tests: adapt `test/integration/attachment_pipeline_test.exs`, add parity with `tests/test_tool_output_conversion.py` and new vector store config fixtures.
- Telemetry/tracing/usage: introduce span-based tracing with processors and usage aggregation; expose trace metadata toggles. Owner: Observability. Tests: port `tests/test_tracing.py`, `tests/test_agent_tracing.py`, `tests/test_usage.py`, plus telemetry regression over codex events.
- Streaming/error handling: build semantic streaming events, soft-cancel, and guardrail streaming; ensure error propagation matches Python. Owner: Runtime. Tests: mirror `tests/test_agent_runner_streamed.py`, `tests/test_cancel_streaming.py`, `tests/test_tracing_errors_streamed.py`.
- Documentation & examples: update Elixir docs/examples to mirror Python patterns (handoffs, guardrails, tool outputs, MCP); highlight unsupported realtime/voice features if out of scope. Owner: Docs. Tests: run `mix format`, ensure examples compile; manual verification against new APIs.
Notes
- Realtime/voice stack in Python (`tests/realtime/*`, `tests/voice/*`) is currently unaddressed; investigate codex support before committing to parity or document exclusion.***