codexapi 0.3.3__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codexapi-0.3.3/src/codexapi.egg-info → codexapi-0.4.0}/PKG-INFO +11 -10
- {codexapi-0.3.3 → codexapi-0.4.0}/README.md +10 -9
- {codexapi-0.3.3 → codexapi-0.4.0}/pyproject.toml +1 -1
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi/__init__.py +1 -1
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi/agent.py +2 -2
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi/cli.py +18 -3
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi/ralph.py +2 -2
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi/task.py +3 -3
- {codexapi-0.3.3 → codexapi-0.4.0/src/codexapi.egg-info}/PKG-INFO +11 -10
- {codexapi-0.3.3 → codexapi-0.4.0}/LICENSE +0 -0
- {codexapi-0.3.3 → codexapi-0.4.0}/setup.cfg +0 -0
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi/__main__.py +0 -0
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi.egg-info/SOURCES.txt +0 -0
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi.egg-info/dependency_links.txt +0 -0
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi.egg-info/entry_points.txt +0 -0
- {codexapi-0.3.3 → codexapi-0.4.0}/src/codexapi.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: codexapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Minimal Python API for running the Codex CLI.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: codex,agent,cli,openai
|
|
@@ -85,6 +85,8 @@ Resume a session and print the thread id to stderr:
|
|
|
85
85
|
codexapi run --thread-id THREAD_ID --print-thread-id "Continue where we left off."
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
Use `--no-yolo` to run Codex with `--full-auto` instead.
|
|
89
|
+
|
|
88
90
|
Ralph loop mode repeats the same prompt until a completion promise or a max
|
|
89
91
|
iteration cap is hit (0 means unlimited). Cancel by deleting
|
|
90
92
|
`.codexapi/ralph-loop.local.md` or running `codexapi ralph --cancel`.
|
|
@@ -97,27 +99,27 @@ codexapi ralph --cancel --cwd /path/to/project
|
|
|
97
99
|
|
|
98
100
|
## API
|
|
99
101
|
|
|
100
|
-
### `agent(prompt, cwd=None, yolo=
|
|
102
|
+
### `agent(prompt, cwd=None, yolo=True, flags=None) -> str`
|
|
101
103
|
|
|
102
104
|
Runs a single Codex turn and returns only the agent's message. Any reasoning
|
|
103
105
|
items are filtered out.
|
|
104
106
|
|
|
105
107
|
- `prompt` (str): prompt to send to Codex.
|
|
106
108
|
- `cwd` (str | PathLike | None): working directory for the Codex session.
|
|
107
|
-
- `yolo` (bool): pass `--yolo` to Codex when true.
|
|
109
|
+
- `yolo` (bool): pass `--yolo` to Codex when true (defaults to true).
|
|
108
110
|
- `flags` (str | None): extra CLI flags to pass to Codex.
|
|
109
111
|
|
|
110
|
-
### `Agent(cwd=None, yolo=
|
|
112
|
+
### `Agent(cwd=None, yolo=True, thread_id=None, flags=None)`
|
|
111
113
|
|
|
112
114
|
Creates a stateful session wrapper. Calling the instance sends the prompt into
|
|
113
115
|
the same conversation and returns only the agent's message.
|
|
114
116
|
|
|
115
117
|
- `__call__(prompt) -> str`: send a prompt to Codex and return the message.
|
|
116
118
|
- `thread_id -> str | None`: expose the underlying session id once created.
|
|
117
|
-
- `yolo` (bool): pass `--yolo` to Codex when true.
|
|
119
|
+
- `yolo` (bool): pass `--yolo` to Codex when true (defaults to true).
|
|
118
120
|
- `flags` (str | None): extra CLI flags to pass to Codex.
|
|
119
121
|
|
|
120
|
-
### `task(prompt, check=None, n=10, cwd=None, yolo=
|
|
122
|
+
### `task(prompt, check=None, n=10, cwd=None, yolo=True, flags=None) -> str`
|
|
121
123
|
|
|
122
124
|
Runs a task with checker-driven retries and returns the success summary.
|
|
123
125
|
Raises `TaskFailed` when the maximum attempts are reached.
|
|
@@ -125,12 +127,12 @@ Raises `TaskFailed` when the maximum attempts are reached.
|
|
|
125
127
|
- `check` (str | None | False): custom check prompt, default checker, or `False` to skip.
|
|
126
128
|
- `n` (int): maximum number of retries after a failed check.
|
|
127
129
|
|
|
128
|
-
### `task_result(prompt, check=None, n=10, cwd=None, yolo=
|
|
130
|
+
### `task_result(prompt, check=None, n=10, cwd=None, yolo=True, flags=None) -> TaskResult`
|
|
129
131
|
|
|
130
132
|
Runs a task with checker-driven retries and returns a `TaskResult` without
|
|
131
133
|
raising `TaskFailed`.
|
|
132
134
|
|
|
133
|
-
### `Task(prompt, max_attempts=10, cwd=None, yolo=
|
|
135
|
+
### `Task(prompt, max_attempts=10, cwd=None, yolo=True, thread_id=None, flags=None)`
|
|
134
136
|
|
|
135
137
|
Runs a Codex task with checker-driven retries. Subclass it and implement
|
|
136
138
|
`check()` to return an error string when the task is incomplete, or return
|
|
@@ -165,8 +167,7 @@ Exception raised by `task()` when retries are exhausted.
|
|
|
165
167
|
|
|
166
168
|
- Uses `codex exec --json` and parses JSONL events for `agent_message` items.
|
|
167
169
|
- Automatically passes `--skip-git-repo-check` so it can run outside a git repo.
|
|
168
|
-
- Passes `--
|
|
169
|
-
- Passes `--yolo` when enabled (use with care).
|
|
170
|
+
- Passes `--yolo` by default (use `--no-yolo` or `yolo=False` for `--full-auto`).
|
|
170
171
|
- Raises `RuntimeError` if Codex exits non-zero or returns no agent message.
|
|
171
172
|
|
|
172
173
|
## Configuration
|
|
@@ -73,6 +73,8 @@ Resume a session and print the thread id to stderr:
|
|
|
73
73
|
codexapi run --thread-id THREAD_ID --print-thread-id "Continue where we left off."
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
Use `--no-yolo` to run Codex with `--full-auto` instead.
|
|
77
|
+
|
|
76
78
|
Ralph loop mode repeats the same prompt until a completion promise or a max
|
|
77
79
|
iteration cap is hit (0 means unlimited). Cancel by deleting
|
|
78
80
|
`.codexapi/ralph-loop.local.md` or running `codexapi ralph --cancel`.
|
|
@@ -85,27 +87,27 @@ codexapi ralph --cancel --cwd /path/to/project
|
|
|
85
87
|
|
|
86
88
|
## API
|
|
87
89
|
|
|
88
|
-
### `agent(prompt, cwd=None, yolo=
|
|
90
|
+
### `agent(prompt, cwd=None, yolo=True, flags=None) -> str`
|
|
89
91
|
|
|
90
92
|
Runs a single Codex turn and returns only the agent's message. Any reasoning
|
|
91
93
|
items are filtered out.
|
|
92
94
|
|
|
93
95
|
- `prompt` (str): prompt to send to Codex.
|
|
94
96
|
- `cwd` (str | PathLike | None): working directory for the Codex session.
|
|
95
|
-
- `yolo` (bool): pass `--yolo` to Codex when true.
|
|
97
|
+
- `yolo` (bool): pass `--yolo` to Codex when true (defaults to true).
|
|
96
98
|
- `flags` (str | None): extra CLI flags to pass to Codex.
|
|
97
99
|
|
|
98
|
-
### `Agent(cwd=None, yolo=
|
|
100
|
+
### `Agent(cwd=None, yolo=True, thread_id=None, flags=None)`
|
|
99
101
|
|
|
100
102
|
Creates a stateful session wrapper. Calling the instance sends the prompt into
|
|
101
103
|
the same conversation and returns only the agent's message.
|
|
102
104
|
|
|
103
105
|
- `__call__(prompt) -> str`: send a prompt to Codex and return the message.
|
|
104
106
|
- `thread_id -> str | None`: expose the underlying session id once created.
|
|
105
|
-
- `yolo` (bool): pass `--yolo` to Codex when true.
|
|
107
|
+
- `yolo` (bool): pass `--yolo` to Codex when true (defaults to true).
|
|
106
108
|
- `flags` (str | None): extra CLI flags to pass to Codex.
|
|
107
109
|
|
|
108
|
-
### `task(prompt, check=None, n=10, cwd=None, yolo=
|
|
110
|
+
### `task(prompt, check=None, n=10, cwd=None, yolo=True, flags=None) -> str`
|
|
109
111
|
|
|
110
112
|
Runs a task with checker-driven retries and returns the success summary.
|
|
111
113
|
Raises `TaskFailed` when the maximum attempts are reached.
|
|
@@ -113,12 +115,12 @@ Raises `TaskFailed` when the maximum attempts are reached.
|
|
|
113
115
|
- `check` (str | None | False): custom check prompt, default checker, or `False` to skip.
|
|
114
116
|
- `n` (int): maximum number of retries after a failed check.
|
|
115
117
|
|
|
116
|
-
### `task_result(prompt, check=None, n=10, cwd=None, yolo=
|
|
118
|
+
### `task_result(prompt, check=None, n=10, cwd=None, yolo=True, flags=None) -> TaskResult`
|
|
117
119
|
|
|
118
120
|
Runs a task with checker-driven retries and returns a `TaskResult` without
|
|
119
121
|
raising `TaskFailed`.
|
|
120
122
|
|
|
121
|
-
### `Task(prompt, max_attempts=10, cwd=None, yolo=
|
|
123
|
+
### `Task(prompt, max_attempts=10, cwd=None, yolo=True, thread_id=None, flags=None)`
|
|
122
124
|
|
|
123
125
|
Runs a Codex task with checker-driven retries. Subclass it and implement
|
|
124
126
|
`check()` to return an error string when the task is incomplete, or return
|
|
@@ -153,8 +155,7 @@ Exception raised by `task()` when retries are exhausted.
|
|
|
153
155
|
|
|
154
156
|
- Uses `codex exec --json` and parses JSONL events for `agent_message` items.
|
|
155
157
|
- Automatically passes `--skip-git-repo-check` so it can run outside a git repo.
|
|
156
|
-
- Passes `--
|
|
157
|
-
- Passes `--yolo` when enabled (use with care).
|
|
158
|
+
- Passes `--yolo` by default (use `--no-yolo` or `yolo=False` for `--full-auto`).
|
|
158
159
|
- Raises `RuntimeError` if Codex exits non-zero or returns no agent message.
|
|
159
160
|
|
|
160
161
|
## Configuration
|
|
@@ -8,7 +8,7 @@ import subprocess
|
|
|
8
8
|
_CODEX_BIN = os.environ.get("CODEX_BIN", "codex")
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def agent(prompt, cwd=None, yolo=
|
|
11
|
+
def agent(prompt, cwd=None, yolo=True, flags=None):
|
|
12
12
|
"""Run a single Codex turn and return only the agent's message.
|
|
13
13
|
|
|
14
14
|
Args:
|
|
@@ -36,7 +36,7 @@ class Agent:
|
|
|
36
36
|
def __init__(
|
|
37
37
|
self,
|
|
38
38
|
cwd=None,
|
|
39
|
-
yolo=
|
|
39
|
+
yolo=True,
|
|
40
40
|
thread_id=None,
|
|
41
41
|
flags=None,
|
|
42
42
|
):
|
|
@@ -908,7 +908,12 @@ def main(argv=None):
|
|
|
908
908
|
help="Prompt to send. Use '-' or omit to read from stdin.",
|
|
909
909
|
)
|
|
910
910
|
run_parser.add_argument("--cwd", help="Working directory for the Codex session.")
|
|
911
|
-
run_parser.add_argument(
|
|
911
|
+
run_parser.add_argument(
|
|
912
|
+
"--no-yolo",
|
|
913
|
+
action="store_false",
|
|
914
|
+
dest="yolo",
|
|
915
|
+
help="Disable --yolo and use --full-auto.",
|
|
916
|
+
)
|
|
912
917
|
run_parser.add_argument(
|
|
913
918
|
"--flags",
|
|
914
919
|
help="Additional raw CLI flags to pass to Codex (quoted as needed).",
|
|
@@ -943,7 +948,12 @@ def main(argv=None):
|
|
|
943
948
|
help="Max verification retries after a failed check (0 means no retries).",
|
|
944
949
|
)
|
|
945
950
|
task_parser.add_argument("--cwd", help="Working directory for the Codex session.")
|
|
946
|
-
task_parser.add_argument(
|
|
951
|
+
task_parser.add_argument(
|
|
952
|
+
"--no-yolo",
|
|
953
|
+
action="store_false",
|
|
954
|
+
dest="yolo",
|
|
955
|
+
help="Disable --yolo and use --full-auto.",
|
|
956
|
+
)
|
|
947
957
|
task_parser.add_argument(
|
|
948
958
|
"--flags",
|
|
949
959
|
help="Additional raw CLI flags to pass to Codex (quoted as needed).",
|
|
@@ -986,7 +996,12 @@ def main(argv=None):
|
|
|
986
996
|
help="Start each iteration with a fresh Agent context.",
|
|
987
997
|
)
|
|
988
998
|
ralph_parser.add_argument("--cwd", help="Working directory for the Codex session.")
|
|
989
|
-
ralph_parser.add_argument(
|
|
999
|
+
ralph_parser.add_argument(
|
|
1000
|
+
"--no-yolo",
|
|
1001
|
+
action="store_false",
|
|
1002
|
+
dest="yolo",
|
|
1003
|
+
help="Disable --yolo and use --full-auto.",
|
|
1004
|
+
)
|
|
990
1005
|
ralph_parser.add_argument(
|
|
991
1006
|
"--flags",
|
|
992
1007
|
help="Additional raw CLI flags to pass to Codex (quoted as needed).",
|
|
@@ -15,7 +15,7 @@ _PROMISE_RE = re.compile(r"<promise>(.*?)</promise>", re.DOTALL)
|
|
|
15
15
|
def run_ralph_loop(
|
|
16
16
|
prompt,
|
|
17
17
|
cwd=None,
|
|
18
|
-
yolo=
|
|
18
|
+
yolo=True,
|
|
19
19
|
flags=None,
|
|
20
20
|
max_iterations=0,
|
|
21
21
|
completion_promise=None,
|
|
@@ -135,7 +135,7 @@ def run_ralph_loop(
|
|
|
135
135
|
elif runner is None:
|
|
136
136
|
runner = Agent(cwd, yolo, None, flags)
|
|
137
137
|
|
|
138
|
-
message = runner(prompt)
|
|
138
|
+
message = runner(prompt + '\nIf there are multiple paths forward, you MUST use your own best judgement as to which to try first! Do not ask the user to choose an option, they hereby give you explciit permission to pick the best one yourself.\n')
|
|
139
139
|
print(message)
|
|
140
140
|
last_message = message
|
|
141
141
|
|
|
@@ -176,7 +176,7 @@ def task(
|
|
|
176
176
|
check=None,
|
|
177
177
|
n=10,
|
|
178
178
|
cwd=None,
|
|
179
|
-
yolo=
|
|
179
|
+
yolo=True,
|
|
180
180
|
flags=None,
|
|
181
181
|
progress=False,
|
|
182
182
|
):
|
|
@@ -209,7 +209,7 @@ def task_result(
|
|
|
209
209
|
check=None,
|
|
210
210
|
n=10,
|
|
211
211
|
cwd=None,
|
|
212
|
-
yolo=
|
|
212
|
+
yolo=True,
|
|
213
213
|
flags=None,
|
|
214
214
|
progress=False,
|
|
215
215
|
):
|
|
@@ -319,7 +319,7 @@ class Task:
|
|
|
319
319
|
prompt,
|
|
320
320
|
max_attempts=10,
|
|
321
321
|
cwd=None,
|
|
322
|
-
yolo=
|
|
322
|
+
yolo=True,
|
|
323
323
|
thread_id=None,
|
|
324
324
|
flags=None,
|
|
325
325
|
):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: codexapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Minimal Python API for running the Codex CLI.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: codex,agent,cli,openai
|
|
@@ -85,6 +85,8 @@ Resume a session and print the thread id to stderr:
|
|
|
85
85
|
codexapi run --thread-id THREAD_ID --print-thread-id "Continue where we left off."
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
Use `--no-yolo` to run Codex with `--full-auto` instead.
|
|
89
|
+
|
|
88
90
|
Ralph loop mode repeats the same prompt until a completion promise or a max
|
|
89
91
|
iteration cap is hit (0 means unlimited). Cancel by deleting
|
|
90
92
|
`.codexapi/ralph-loop.local.md` or running `codexapi ralph --cancel`.
|
|
@@ -97,27 +99,27 @@ codexapi ralph --cancel --cwd /path/to/project
|
|
|
97
99
|
|
|
98
100
|
## API
|
|
99
101
|
|
|
100
|
-
### `agent(prompt, cwd=None, yolo=
|
|
102
|
+
### `agent(prompt, cwd=None, yolo=True, flags=None) -> str`
|
|
101
103
|
|
|
102
104
|
Runs a single Codex turn and returns only the agent's message. Any reasoning
|
|
103
105
|
items are filtered out.
|
|
104
106
|
|
|
105
107
|
- `prompt` (str): prompt to send to Codex.
|
|
106
108
|
- `cwd` (str | PathLike | None): working directory for the Codex session.
|
|
107
|
-
- `yolo` (bool): pass `--yolo` to Codex when true.
|
|
109
|
+
- `yolo` (bool): pass `--yolo` to Codex when true (defaults to true).
|
|
108
110
|
- `flags` (str | None): extra CLI flags to pass to Codex.
|
|
109
111
|
|
|
110
|
-
### `Agent(cwd=None, yolo=
|
|
112
|
+
### `Agent(cwd=None, yolo=True, thread_id=None, flags=None)`
|
|
111
113
|
|
|
112
114
|
Creates a stateful session wrapper. Calling the instance sends the prompt into
|
|
113
115
|
the same conversation and returns only the agent's message.
|
|
114
116
|
|
|
115
117
|
- `__call__(prompt) -> str`: send a prompt to Codex and return the message.
|
|
116
118
|
- `thread_id -> str | None`: expose the underlying session id once created.
|
|
117
|
-
- `yolo` (bool): pass `--yolo` to Codex when true.
|
|
119
|
+
- `yolo` (bool): pass `--yolo` to Codex when true (defaults to true).
|
|
118
120
|
- `flags` (str | None): extra CLI flags to pass to Codex.
|
|
119
121
|
|
|
120
|
-
### `task(prompt, check=None, n=10, cwd=None, yolo=
|
|
122
|
+
### `task(prompt, check=None, n=10, cwd=None, yolo=True, flags=None) -> str`
|
|
121
123
|
|
|
122
124
|
Runs a task with checker-driven retries and returns the success summary.
|
|
123
125
|
Raises `TaskFailed` when the maximum attempts are reached.
|
|
@@ -125,12 +127,12 @@ Raises `TaskFailed` when the maximum attempts are reached.
|
|
|
125
127
|
- `check` (str | None | False): custom check prompt, default checker, or `False` to skip.
|
|
126
128
|
- `n` (int): maximum number of retries after a failed check.
|
|
127
129
|
|
|
128
|
-
### `task_result(prompt, check=None, n=10, cwd=None, yolo=
|
|
130
|
+
### `task_result(prompt, check=None, n=10, cwd=None, yolo=True, flags=None) -> TaskResult`
|
|
129
131
|
|
|
130
132
|
Runs a task with checker-driven retries and returns a `TaskResult` without
|
|
131
133
|
raising `TaskFailed`.
|
|
132
134
|
|
|
133
|
-
### `Task(prompt, max_attempts=10, cwd=None, yolo=
|
|
135
|
+
### `Task(prompt, max_attempts=10, cwd=None, yolo=True, thread_id=None, flags=None)`
|
|
134
136
|
|
|
135
137
|
Runs a Codex task with checker-driven retries. Subclass it and implement
|
|
136
138
|
`check()` to return an error string when the task is incomplete, or return
|
|
@@ -165,8 +167,7 @@ Exception raised by `task()` when retries are exhausted.
|
|
|
165
167
|
|
|
166
168
|
- Uses `codex exec --json` and parses JSONL events for `agent_message` items.
|
|
167
169
|
- Automatically passes `--skip-git-repo-check` so it can run outside a git repo.
|
|
168
|
-
- Passes `--
|
|
169
|
-
- Passes `--yolo` when enabled (use with care).
|
|
170
|
+
- Passes `--yolo` by default (use `--no-yolo` or `yolo=False` for `--full-auto`).
|
|
170
171
|
- Raises `RuntimeError` if Codex exits non-zero or returns no agent message.
|
|
171
172
|
|
|
172
173
|
## Configuration
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|