Skip to content

Latest commit

 

History

History
113 lines (84 loc) · 4.72 KB

File metadata and controls

113 lines (84 loc) · 4.72 KB

Python Client Introduction

Purpose

The codex-manager Python client is a control-plane SDK for codex-manager APIs and websocket events.

Use it when you need Python workflows to:

  • create/read/update chats and projects
  • control turns, approvals, and tool-input decisions
  • read/write per-session settings used by UI and extensions
  • subscribe to realtime events and app-server signal pass-through
  • synchronize async/sync workflows with generic and session-aware wait helpers
  • orchestrate queue/supervisor automation
  • handle dynamic item/tool/call requests with Python remote-skill handlers through codex-manager routes

Practical workflow categories

  • script repeatable session tasks (create, message, inspect transcript)
  • run approval/tool-input queues from service workers
  • apply and read session settings used by UI and extensions
  • host long-running stream listeners for automation triggers

Install

From repository root:

pip install -e packages/python-client

First use

from codex_manager import CodexManager

cm = CodexManager.from_profile("local")
health = cm.system.health()
print(health["status"])
cm.close()

Client types

  • CodexManager: sync workflows
  • AsyncCodexManager: async workflows, high-throughput event handling, long-running services

Both clients expose the same domain structure.

Both clients also expose polling-based wait helpers for synchronization:

  • cm.wait.until(...) / await acm.wait.until(...) for generic conditions
  • cm.wait.turn_status(...) / await acm.wait.turn_status(...) for turn-status reads and expected-status waits
  • cm.wait.send_message_and_wait_reply(...) / await acm.wait.send_message_and_wait_reply(...) for request/reply flows
  • default polling cadence is latency-oriented (interval_seconds=0.25) and can be overridden per call when slower polling is preferred

Typed OpenAPI facade

Both clients also expose a typed facade:

  • cm.typed for sync
  • acm.typed for async

Typed methods use generated Pydantic models from OpenAPI and return typed responses for supported operations while keeping all existing dict-based domains unchanged.

Advanced extension points

Both clients now support protocol-based dependency injection for advanced integrations:

  • custom request executors (request_executor)
  • dynamic header providers (header_provider)
  • explicit retry policies (retry_policy, retryable_operations)
  • custom hook registries (hook_registry)
  • injectable stream routers (stream_router)
  • deterministic client plugins (plugins)

Hook middleware objects can be registered directly with use_middleware(...) in addition to decorator hooks.

Documentation map

Recommended paths by use case