Add Python SDK goal turns

This commit is contained in:
Ahmed Ibrahim
2026-06-07 15:48:51 -07:00
parent e093d81982
commit 851a85b369
50 changed files with 2909 additions and 136 deletions

View File

@@ -0,0 +1,28 @@
import sys
from pathlib import Path
_EXAMPLES_ROOT = Path(__file__).resolve().parents[1]
if str(_EXAMPLES_ROOT) not in sys.path:
sys.path.insert(0, str(_EXAMPLES_ROOT))
from _bootstrap import ensure_local_sdk_src, runtime_config
ensure_local_sdk_src()
import asyncio
from openai_codex import AsyncCodex
async def main() -> None:
async with AsyncCodex(config=runtime_config()) as codex:
thread = await codex.thread_start()
result = await thread.run(
"Improve the benchmark coverage in this repository.",
goal=True,
)
print(result.final_response)
if __name__ == "__main__":
asyncio.run(main())

View File

@@ -0,0 +1,17 @@
import sys
from pathlib import Path
_EXAMPLES_ROOT = Path(__file__).resolve().parents[1]
if str(_EXAMPLES_ROOT) not in sys.path:
sys.path.insert(0, str(_EXAMPLES_ROOT))
from _bootstrap import ensure_local_sdk_src, runtime_config
ensure_local_sdk_src()
from openai_codex import Codex
with Codex(config=runtime_config()) as codex:
thread = codex.thread_start()
result = thread.run("Improve the benchmark coverage in this repository.", goal=True)
print(result.final_response)

View File

@@ -89,3 +89,5 @@ python examples/01_quickstart_constructor/async.py
- separate `steer()` and `interrupt()` demos with concise summaries
- `15_login_and_account/`
- browser-login handle lifecycle, cancellation, and account inspection
- `16_goal_turns/`
- run a longer autonomous objective as one logical turn