agentic-python-coder 2.2.0__tar.gz → 2.2.1__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.
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/.gitignore +1 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/PKG-INFO +1 -1
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/prompts/system.md +3 -15
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/prompts/system_todo.md +10 -22
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/__init__.py +1 -1
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/agent.py +2 -3
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/runner.py +1 -28
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/tools.py +1 -44
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_library_api.py +16 -12
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_todo_tool_availability.py +2 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/pyproject.toml +1 -1
- agentic_python_coder-2.2.0/examples/cpmpy/README.md +0 -69
- agentic_python_coder-2.2.0/examples/cpmpy/cpmpy.md +0 -46
- agentic_python_coder-2.2.0/examples/cpmpy/sample_problems/magic_square.md +0 -46
- agentic_python_coder-2.2.0/examples/cpmpy/sample_problems/n_queens.md +0 -36
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/LICENSE +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/README.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/.gitignore +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/cli.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/__init__.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/README.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/clingo.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/sample_tasks/bird_reasoning.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/sample_tasks/diagnosis.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/sample_tasks/simple_coloring.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/sample_tasks/stable_marriage.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/clingo/sample_tasks/sudoku_mini.md +0 -0
- {agentic_python_coder-2.2.0/coder-examples → agentic_python_coder-2.2.1/coder/src/agentic_python_coder/examples}/cpmpy/README.md +0 -0
- {agentic_python_coder-2.2.0/coder-examples → agentic_python_coder-2.2.1/coder/src/agentic_python_coder/examples}/cpmpy/cpmpy.md +0 -0
- {agentic_python_coder-2.2.0/coder-examples → agentic_python_coder-2.2.1/coder/src/agentic_python_coder/examples}/cpmpy/sample_tasks/magic_square.md +0 -0
- {agentic_python_coder-2.2.0/coder-examples → agentic_python_coder-2.2.1/coder/src/agentic_python_coder/examples}/cpmpy/sample_tasks/n_queens.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/regex/README.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/regex/regex.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/regex/sample_tasks/email_extraction.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/regex/sample_tasks/phone_validation.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/examples/regex/sample_tasks/url_parsing.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/kernel.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/llm.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/mcp_server.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/deepseek31.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/gemini25.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/gpt5.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/grok41.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/opus45.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/qwen3.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/models/sonnet45.json +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/project_md.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_kernel.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_mcp_server.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_todo_flag_integration.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/README.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/clingo.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/sample_tasks/bird_reasoning.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/sample_tasks/diagnosis.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/sample_tasks/simple_coloring.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/sample_tasks/stable_marriage.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/sample_tasks/sudoku_mini.md +0 -0
- {agentic_python_coder-2.2.0/coder/src/agentic_python_coder → agentic_python_coder-2.2.1}/examples/cpmpy/README.md +0 -0
- {agentic_python_coder-2.2.0/coder/src/agentic_python_coder → agentic_python_coder-2.2.1}/examples/cpmpy/cpmpy.md +0 -0
- {agentic_python_coder-2.2.0/coder/src/agentic_python_coder/examples/cpmpy/sample_tasks → agentic_python_coder-2.2.1/examples/cpmpy/sample_problems}/magic_square.md +0 -0
- {agentic_python_coder-2.2.0/coder/src/agentic_python_coder/examples/cpmpy/sample_tasks → agentic_python_coder-2.2.1/examples/cpmpy/sample_problems}/n_queens.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/README.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/regex.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/email_extraction.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/phone_validation.md +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/test_email/email_extractor.py +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/test_email/extracted_emails.txt +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/test_email/text.txt +0 -0
- {agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/url_parsing.md +0 -0
|
@@ -16,19 +16,12 @@ You have access to these specialized tools:
|
|
|
16
16
|
- Call this ONCE when you have a complete, working solution
|
|
17
17
|
- The code will be saved to {basename}_code.py
|
|
18
18
|
|
|
19
|
-
3. **report_issue**: Provide feedback and summary
|
|
20
|
-
- Use at the end to summarize what was accomplished
|
|
21
|
-
- Report any issues, ambiguities, or difficulties encountered
|
|
22
|
-
- Also report if everything worked perfectly
|
|
23
|
-
- This feedback will be included in the log file
|
|
24
|
-
|
|
25
19
|
## Workflow
|
|
26
20
|
|
|
27
21
|
1. **Understand the Task**: Read the problem in the <task> section carefully
|
|
28
22
|
2. **Plan Your Approach**: Think through the problem and plan your solution strategy
|
|
29
23
|
3. **Develop Solution**: Use python_exec iteratively to build and test
|
|
30
24
|
4. **Save Final Code**: Call save_code with your complete solution
|
|
31
|
-
5. **Provide Feedback**: Use report_issue to summarize and provide feedback
|
|
32
25
|
|
|
33
26
|
## Python Execution Best Practices
|
|
34
27
|
|
|
@@ -68,8 +61,7 @@ Build solutions incrementally:
|
|
|
68
61
|
1. **Focus on the Task**: Complete what's requested, nothing more
|
|
69
62
|
2. **Test Efficiently**: One or two test cases are usually sufficient
|
|
70
63
|
3. **Save Once**: Call save_code only when you have the final code
|
|
71
|
-
4. **
|
|
72
|
-
5. **Stop When Done**: Don't add features not requested
|
|
64
|
+
4. **Stop When Done**: Don't add features not requested
|
|
73
65
|
|
|
74
66
|
## Error Recovery
|
|
75
67
|
|
|
@@ -94,10 +86,6 @@ When finishing:
|
|
|
94
86
|
1. Verify the solution works correctly
|
|
95
87
|
2. Clean the code according to the **Code Cleaning Requirements** above
|
|
96
88
|
3. Call save_code with the complete, cleaned code
|
|
97
|
-
4.
|
|
98
|
-
- Summarize what was accomplished
|
|
99
|
-
- Report any issues, ambiguities, or difficulties encountered
|
|
100
|
-
- Even if everything worked perfectly, report: "All is fine - no issues encountered."
|
|
101
|
-
5. STOP - do not continue unless asked
|
|
89
|
+
4. STOP - do not continue unless asked
|
|
102
90
|
|
|
103
|
-
Your goal is efficient, focused problem-solving.
|
|
91
|
+
Your goal is efficient, focused problem-solving.
|
|
@@ -16,35 +16,28 @@ You have access to these specialized tools:
|
|
|
16
16
|
- Call this ONCE when you have a complete, working solution
|
|
17
17
|
- The code will be saved to {basename}_code.py
|
|
18
18
|
|
|
19
|
-
3. **
|
|
20
|
-
- Use at the end to summarize what was accomplished
|
|
21
|
-
- Report any issues, ambiguities, or difficulties encountered
|
|
22
|
-
- Also report if everything worked perfectly
|
|
23
|
-
- This feedback will be included in the log file
|
|
24
|
-
|
|
25
|
-
4. **todo_write**: MANDATORY task management tool
|
|
19
|
+
3. **todo_write**: MANDATORY task management tool
|
|
26
20
|
- You MUST use this tool after understanding the problem
|
|
27
21
|
- Create a todo list with items appropriate to the problem complexity
|
|
28
22
|
(ranging from 3 simple items to over a dozen for complex problems)
|
|
29
23
|
- Update todo item status as you progress (pending → in_progress → completed)
|
|
30
24
|
- Only ONE todo item can be in_progress at a time
|
|
31
25
|
- Add new todo items if you discover additional work needed
|
|
32
|
-
- Your last
|
|
26
|
+
- Your last two todo items should always be: "Clean final code" and "Save final code"
|
|
33
27
|
|
|
34
28
|
## Workflow
|
|
35
29
|
|
|
36
30
|
1. **Understand the Task**: Read the problem in the <task> section carefully
|
|
37
|
-
2. **Plan Your Approach** (MANDATORY):
|
|
31
|
+
2. **Plan Your Approach** (MANDATORY):
|
|
38
32
|
- Use todo_write to create your todo list based on your understanding
|
|
39
33
|
- The number of todo items should match problem complexity (3-12+ items)
|
|
40
|
-
- Include "Save final code"
|
|
34
|
+
- Include "Save final code" as your last item
|
|
41
35
|
- This demonstrates planning and helps track progress
|
|
42
36
|
3. **Develop Solution**: Use python_exec iteratively to build and test
|
|
43
37
|
- Mark todo items as in_progress when starting them
|
|
44
38
|
- Mark as completed when done
|
|
45
|
-
4. **Clean Final Code**: Clean the code according to Code Cleaning Requirements (
|
|
46
|
-
5. **Save Final Code**: Call save_code with your complete, cleaned solution (
|
|
47
|
-
6. **Provide Feedback**: Use report_issue to summarize and provide feedback (final todo item)
|
|
39
|
+
4. **Clean Final Code**: Clean the code according to Code Cleaning Requirements (second-to-last todo item)
|
|
40
|
+
5. **Save Final Code**: Call save_code with your complete, cleaned solution (final todo item)
|
|
48
41
|
|
|
49
42
|
## Python Execution Best Practices
|
|
50
43
|
|
|
@@ -85,8 +78,7 @@ Build solutions incrementally:
|
|
|
85
78
|
2. **Focus on the Task**: Complete what's requested, nothing more
|
|
86
79
|
3. **Test Efficiently**: One or two test cases are usually sufficient
|
|
87
80
|
4. **Save Once**: Call save_code only when you have the final code
|
|
88
|
-
5. **
|
|
89
|
-
6. **Stop When Done**: Don't add features not requested
|
|
81
|
+
5. **Stop When Done**: Don't add features not requested
|
|
90
82
|
|
|
91
83
|
## Error Recovery
|
|
92
84
|
|
|
@@ -111,13 +103,9 @@ When finishing (these should be your final todo items):
|
|
|
111
103
|
1. Ensure all todo items are marked as completed
|
|
112
104
|
2. Verify the solution works correctly
|
|
113
105
|
3. Clean the code according to the **Code Cleaning Requirements** above
|
|
114
|
-
4. Call save_code with the complete, cleaned code (
|
|
115
|
-
5.
|
|
116
|
-
- Summarize what was accomplished
|
|
117
|
-
- Report any issues, ambiguities, or difficulties encountered
|
|
118
|
-
- Even if everything worked perfectly, report: "All is fine - no issues encountered."
|
|
119
|
-
6. STOP - do not continue unless asked
|
|
106
|
+
4. Call save_code with the complete, cleaned code (final todo item)
|
|
107
|
+
5. STOP - do not continue unless asked
|
|
120
108
|
|
|
121
109
|
Note: Your todo list should show a clear progression from planning through completion.
|
|
122
110
|
|
|
123
|
-
Your goal is efficient, focused problem-solving.
|
|
111
|
+
Your goal is efficient, focused problem-solving.
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/agent.py
RENAMED
|
@@ -10,7 +10,6 @@ from agentic_python_coder.tools import (
|
|
|
10
10
|
todo_write,
|
|
11
11
|
python_exec,
|
|
12
12
|
save_code,
|
|
13
|
-
report_issue,
|
|
14
13
|
working_dir,
|
|
15
14
|
set_task_basename,
|
|
16
15
|
reset_global_state,
|
|
@@ -80,9 +79,9 @@ def create_coding_agent(
|
|
|
80
79
|
|
|
81
80
|
# Minimal tool set
|
|
82
81
|
if todo:
|
|
83
|
-
tools = [python_exec, save_code,
|
|
82
|
+
tools = [python_exec, save_code, todo_write]
|
|
84
83
|
else:
|
|
85
|
-
tools = [python_exec, save_code
|
|
84
|
+
tools = [python_exec, save_code]
|
|
86
85
|
|
|
87
86
|
# Build combined prompt
|
|
88
87
|
prompts = []
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/runner.py
RENAMED
|
@@ -5,7 +5,6 @@ from pathlib import Path
|
|
|
5
5
|
from typing import Optional, List, Any, Dict
|
|
6
6
|
|
|
7
7
|
from agentic_python_coder.agent import create_coding_agent, run_agent
|
|
8
|
-
from agentic_python_coder.tools import get_reported_issues
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
def get_system_prompt_path(todo: bool = False) -> Path:
|
|
@@ -113,16 +112,6 @@ def save_conversation_log(
|
|
|
113
112
|
)
|
|
114
113
|
+ "\n"
|
|
115
114
|
)
|
|
116
|
-
elif tool_name == "report_issue":
|
|
117
|
-
f.write(
|
|
118
|
-
json.dumps(
|
|
119
|
-
{
|
|
120
|
-
"event": "report_issue",
|
|
121
|
-
"issue": tool_args.get("text", "")[:200],
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
+ "\n"
|
|
125
|
-
)
|
|
126
115
|
else:
|
|
127
116
|
f.write(
|
|
128
117
|
json.dumps({"event": "tool_call", "tool": tool_name}) + "\n"
|
|
@@ -162,28 +151,12 @@ def save_conversation_log(
|
|
|
162
151
|
+ "\n"
|
|
163
152
|
)
|
|
164
153
|
|
|
165
|
-
# Agent feedback
|
|
166
|
-
reported_issues = get_reported_issues()
|
|
167
|
-
if reported_issues:
|
|
168
|
-
for issue in reported_issues:
|
|
169
|
-
f.write(
|
|
170
|
-
json.dumps(
|
|
171
|
-
{
|
|
172
|
-
"event": "agent_feedback",
|
|
173
|
-
"content": issue.get("content", ""),
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
+ "\n"
|
|
177
|
-
)
|
|
178
|
-
|
|
179
154
|
# Complete event
|
|
180
155
|
f.write(
|
|
181
156
|
json.dumps(
|
|
182
157
|
{
|
|
183
158
|
"event": "complete",
|
|
184
|
-
"status": "success"
|
|
185
|
-
if not reported_issues
|
|
186
|
-
else "success_with_issues",
|
|
159
|
+
"status": "success",
|
|
187
160
|
}
|
|
188
161
|
)
|
|
189
162
|
+ "\n"
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/tools.py
RENAMED
|
@@ -221,54 +221,11 @@ def save_code(code: str) -> str:
|
|
|
221
221
|
return error_response(f"Error saving code: {str(e)}")
|
|
222
222
|
|
|
223
223
|
|
|
224
|
-
_reported_issues = []
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
@tool
|
|
228
|
-
def report_issue(text: str) -> str:
|
|
229
|
-
"""Report an environment or specification issue (fileless mode).
|
|
230
|
-
|
|
231
|
-
Use this ONLY for:
|
|
232
|
-
- Missing packages or import errors
|
|
233
|
-
- Unclear task specifications
|
|
234
|
-
- Environment setup problems
|
|
235
|
-
|
|
236
|
-
Do NOT use for:
|
|
237
|
-
- Logic errors in your code
|
|
238
|
-
- Failed test cases
|
|
239
|
-
- Debugging information
|
|
240
|
-
|
|
241
|
-
Args:
|
|
242
|
-
text: Description of the issue
|
|
243
|
-
|
|
244
|
-
Returns:
|
|
245
|
-
JSON with success status
|
|
246
|
-
"""
|
|
247
|
-
try:
|
|
248
|
-
global _reported_issues
|
|
249
|
-
|
|
250
|
-
# Store the issue in memory to be included when log is saved
|
|
251
|
-
_reported_issues.append({"type": "agent_feedback", "content": text})
|
|
252
|
-
|
|
253
|
-
return success_response(
|
|
254
|
-
"Issue reported and will be included in the log", reported=True
|
|
255
|
-
)
|
|
256
|
-
except Exception as e:
|
|
257
|
-
return error_response(f"Error reporting issue: {str(e)}")
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
def get_reported_issues():
|
|
261
|
-
"""Get all reported issues for inclusion in the log."""
|
|
262
|
-
global _reported_issues
|
|
263
|
-
return _reported_issues
|
|
264
|
-
|
|
265
|
-
|
|
266
224
|
def reset_global_state():
|
|
267
225
|
"""Reset all global state to avoid accumulation across runs.
|
|
268
226
|
|
|
269
227
|
Called by create_coding_agent() to ensure clean state for each new agent.
|
|
270
228
|
"""
|
|
271
|
-
global _todos, _task_basename
|
|
229
|
+
global _todos, _task_basename
|
|
272
230
|
_todos = []
|
|
273
231
|
_task_basename = None
|
|
274
|
-
_reported_issues = []
|
|
@@ -15,27 +15,28 @@ def test_imports_from_package():
|
|
|
15
15
|
run_agent,
|
|
16
16
|
get_final_response,
|
|
17
17
|
get_openrouter_llm,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
list_available_models,
|
|
19
|
+
DEFAULT_MODEL,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
assert __version__ == "2.
|
|
22
|
+
assert __version__ == "2.2.1"
|
|
23
23
|
assert callable(solve_task)
|
|
24
24
|
assert callable(create_coding_agent)
|
|
25
25
|
assert callable(run_agent)
|
|
26
26
|
assert callable(get_final_response)
|
|
27
27
|
assert callable(get_openrouter_llm)
|
|
28
|
-
assert
|
|
29
|
-
assert isinstance(
|
|
28
|
+
assert callable(list_available_models)
|
|
29
|
+
assert isinstance(DEFAULT_MODEL, str)
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def test_model_registry():
|
|
33
|
-
"""Test that
|
|
34
|
-
from agentic_python_coder import
|
|
33
|
+
"""Test that list_available_models returns expected models."""
|
|
34
|
+
from agentic_python_coder import list_available_models
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
models = list_available_models()
|
|
37
|
+
expected_models = ["sonnet45", "opus45", "deepseek31", "grok41", "qwen3", "gemini25", "gpt5"]
|
|
37
38
|
for model in expected_models:
|
|
38
|
-
assert model in
|
|
39
|
+
assert model in models, f"Missing model: {model}"
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
def test_create_agent_with_string_prompt():
|
|
@@ -46,7 +47,7 @@ def test_create_agent_with_string_prompt():
|
|
|
46
47
|
agent = create_coding_agent(
|
|
47
48
|
working_directory=tmpdir,
|
|
48
49
|
system_prompt="You are a helpful coding assistant.",
|
|
49
|
-
model="
|
|
50
|
+
model="sonnet45",
|
|
50
51
|
)
|
|
51
52
|
assert agent is not None
|
|
52
53
|
assert agent._coder_metadata["working_directory"] == tmpdir
|
|
@@ -60,6 +61,7 @@ def test_create_agent_metadata():
|
|
|
60
61
|
agent = create_coding_agent(
|
|
61
62
|
working_directory=tmpdir,
|
|
62
63
|
system_prompt="Test",
|
|
64
|
+
model="sonnet45",
|
|
63
65
|
with_packages=["numpy", "pandas"],
|
|
64
66
|
task_basename="test_task",
|
|
65
67
|
)
|
|
@@ -104,7 +106,7 @@ def test_verbose_false_suppresses_output():
|
|
|
104
106
|
agent = create_coding_agent(
|
|
105
107
|
working_directory=tmpdir,
|
|
106
108
|
system_prompt="Test",
|
|
107
|
-
model="
|
|
109
|
+
model="sonnet45",
|
|
108
110
|
verbose=False, # Should suppress output
|
|
109
111
|
)
|
|
110
112
|
output = sys.stdout.getvalue()
|
|
@@ -118,13 +120,14 @@ def test_verbose_false_suppresses_output():
|
|
|
118
120
|
def test_global_state_reset():
|
|
119
121
|
"""Test that global state is reset between agent creations."""
|
|
120
122
|
from agentic_python_coder import create_coding_agent
|
|
121
|
-
from agentic_python_coder.tools import _todos,
|
|
123
|
+
from agentic_python_coder.tools import _todos, _task_basename
|
|
122
124
|
|
|
123
125
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
124
126
|
# Create first agent
|
|
125
127
|
agent1 = create_coding_agent(
|
|
126
128
|
working_directory=tmpdir,
|
|
127
129
|
system_prompt="Test",
|
|
130
|
+
model="sonnet45",
|
|
128
131
|
task_basename="task1",
|
|
129
132
|
)
|
|
130
133
|
|
|
@@ -132,6 +135,7 @@ def test_global_state_reset():
|
|
|
132
135
|
agent2 = create_coding_agent(
|
|
133
136
|
working_directory=tmpdir,
|
|
134
137
|
system_prompt="Test",
|
|
138
|
+
model="sonnet45",
|
|
135
139
|
task_basename="task2",
|
|
136
140
|
)
|
|
137
141
|
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_todo_tool_availability.py
RENAMED
|
@@ -12,6 +12,7 @@ def test_agent_tools_without_todo():
|
|
|
12
12
|
agent = create_coding_agent(
|
|
13
13
|
working_directory=tmpdir,
|
|
14
14
|
system_prompt="Test prompt",
|
|
15
|
+
model="sonnet45",
|
|
15
16
|
todo=False,
|
|
16
17
|
)
|
|
17
18
|
assert agent is not None
|
|
@@ -24,6 +25,7 @@ def test_agent_tools_with_todo():
|
|
|
24
25
|
agent = create_coding_agent(
|
|
25
26
|
working_directory=tmpdir,
|
|
26
27
|
system_prompt="Test prompt",
|
|
28
|
+
model="sonnet45",
|
|
27
29
|
todo=True,
|
|
28
30
|
)
|
|
29
31
|
assert agent is not None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "agentic-python-coder"
|
|
3
|
-
version = "2.2.
|
|
3
|
+
version = "2.2.1"
|
|
4
4
|
description = "A lightweight Python coding agent that writes, executes, and iterates on code through natural language instructions"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13,<3.14"
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# CPMpy Examples
|
|
2
|
-
|
|
3
|
-
Constraint programming examples using CPMpy for solving combinatorial problems.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Recommended: Use --with flag (no installation needed)
|
|
9
|
-
coder --with cpmpy --project cpmpy.md n_queens.md
|
|
10
|
-
|
|
11
|
-
# Alternative: Install CPMpy manually first
|
|
12
|
-
uv pip install cpmpy
|
|
13
|
-
|
|
14
|
-
# Then solve N-Queens problem
|
|
15
|
-
cd sample_problems
|
|
16
|
-
coder --project ../cpmpy.md n_queens.md
|
|
17
|
-
|
|
18
|
-
# Solve Magic Square
|
|
19
|
-
coder --project ../cpmpy.md magic_square.md
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## What's Included
|
|
23
|
-
|
|
24
|
-
The `cpmpy.md` project template provides:
|
|
25
|
-
- CPMpy constraint modeling patterns
|
|
26
|
-
- Common constraint types (AllDifferent, Sum, etc.)
|
|
27
|
-
- Solving strategies and optimization techniques
|
|
28
|
-
|
|
29
|
-
## Sample Problems
|
|
30
|
-
|
|
31
|
-
- **n_queens.md** - Place N queens on a chessboard
|
|
32
|
-
- **magic_square.md** - Create a magic square with equal sums
|
|
33
|
-
|
|
34
|
-
## Create Your Own
|
|
35
|
-
|
|
36
|
-
Write a markdown file with:
|
|
37
|
-
1. Problem description
|
|
38
|
-
2. Input format
|
|
39
|
-
3. Constraints to satisfy
|
|
40
|
-
4. Expected output format
|
|
41
|
-
|
|
42
|
-
Example:
|
|
43
|
-
```
|
|
44
|
-
# Sudoku Solver
|
|
45
|
-
|
|
46
|
-
## Problem
|
|
47
|
-
Fill a 9x9 grid with digits 1-9 following standard Sudoku rules.
|
|
48
|
-
|
|
49
|
-
## Input
|
|
50
|
-
Partial grid with 0 for empty cells
|
|
51
|
-
|
|
52
|
-
## Constraints
|
|
53
|
-
- Each row contains 1-9
|
|
54
|
-
- Each column contains 1-9
|
|
55
|
-
- Each 3x3 box contains 1-9
|
|
56
|
-
|
|
57
|
-
## Output
|
|
58
|
-
Completed grid
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Then run:
|
|
62
|
-
```bash
|
|
63
|
-
coder --project cpmpy.md your_problem.md
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Resources
|
|
67
|
-
|
|
68
|
-
- [CPMpy Documentation](https://cpmpy.readthedocs.io/)
|
|
69
|
-
- [CP-Bench Dataset](https://zenodo.org/records/15592407)
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# CPMPY project prompt
|
|
2
|
-
|
|
3
|
-
You are solving constraint programming problems using CPMpy.
|
|
4
|
-
|
|
5
|
-
## Core Rules
|
|
6
|
-
|
|
7
|
-
1. Use CPMpy's constraint modeling - never write search algorithms
|
|
8
|
-
2. Output ONLY valid JSON using `json.dumps()` - no other text
|
|
9
|
-
3. Always `import json` if outputting JSON
|
|
10
|
-
4. Check the exact output format required
|
|
11
|
-
5. Test your solution manually to verify it satisfies the problem
|
|
12
|
-
|
|
13
|
-
## Basic Template
|
|
14
|
-
```python
|
|
15
|
-
from cpmpy import *
|
|
16
|
-
import json
|
|
17
|
-
|
|
18
|
-
# Variables
|
|
19
|
-
# Constraints
|
|
20
|
-
# Solve
|
|
21
|
-
if model.solve():
|
|
22
|
-
# Build result dict as specified
|
|
23
|
-
result = {...}
|
|
24
|
-
# Verify solution satisfies problem requirements
|
|
25
|
-
print(json.dumps(result))
|
|
26
|
-
else:
|
|
27
|
-
print(json.dumps({"error": "No solution"}))
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Essential Constraints
|
|
31
|
-
- `AllDifferent(vars)` - all different values
|
|
32
|
-
- `sum(vars) == total` - sum constraint
|
|
33
|
-
- `Circuit(x)` - variables x form a Hamiltonian circuit (for routing/tour problems)
|
|
34
|
-
|
|
35
|
-
## Optimization
|
|
36
|
-
- Use `model.minimize(objective)` or `model.maximize(objective)`
|
|
37
|
-
- CPMpy automatically finds the OPTIMAL solution, not just first valid
|
|
38
|
-
- The solver continues searching until it proves optimality
|
|
39
|
-
- Always verify the objective value matches your expectation
|
|
40
|
-
- Example:
|
|
41
|
-
```python
|
|
42
|
-
profit = sum(price[i] * x[i] for i in range(n))
|
|
43
|
-
model.maximize(profit)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
That's it. Read the problem carefully, model it declaratively, and let CPMpy find the optimal solution.
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Magic Square Problem
|
|
2
|
-
|
|
3
|
-
## Problem Description
|
|
4
|
-
Fill an n×n grid with distinct integers from 1 to n² such that the sum of numbers in each row, column, and both main diagonals equals the same "magic constant".
|
|
5
|
-
|
|
6
|
-
## Input Format
|
|
7
|
-
```python
|
|
8
|
-
n = 3 # Size of the square
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Magic Constant
|
|
12
|
-
For an n×n magic square using numbers 1 to n², the magic constant is:
|
|
13
|
-
```
|
|
14
|
-
magic_constant = n * (n² + 1) / 2
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Output Format
|
|
18
|
-
Return a 2D array representing the magic square.
|
|
19
|
-
|
|
20
|
-
## Example
|
|
21
|
-
For n=3, one solution is:
|
|
22
|
-
```
|
|
23
|
-
2 7 6
|
|
24
|
-
9 5 1
|
|
25
|
-
4 3 8
|
|
26
|
-
```
|
|
27
|
-
Each row, column, and diagonal sums to 15.
|
|
28
|
-
|
|
29
|
-
## Constraints
|
|
30
|
-
- Use CPMPy for constraint modeling
|
|
31
|
-
- All numbers from 1 to n² must be used exactly once
|
|
32
|
-
- All rows must sum to the magic constant
|
|
33
|
-
- All columns must sum to the magic constant
|
|
34
|
-
- Both diagonals must sum to the magic constant
|
|
35
|
-
|
|
36
|
-
## Test Cases
|
|
37
|
-
```python
|
|
38
|
-
# n=3: Magic constant = 15
|
|
39
|
-
# n=4: Magic constant = 34
|
|
40
|
-
# n=5: Magic constant = 65
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Implementation Notes
|
|
44
|
-
- Use AllDifferent constraint for uniqueness
|
|
45
|
-
- Consider symmetry breaking to reduce search space
|
|
46
|
-
- For odd n, there are known construction methods, but use constraint solving
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# N-Queens Problem
|
|
2
|
-
|
|
3
|
-
## Problem Description
|
|
4
|
-
Place N queens on an N×N chessboard such that no two queens threaten each other. A queen can attack any piece in the same row, column, or diagonal.
|
|
5
|
-
|
|
6
|
-
## Input Format
|
|
7
|
-
```python
|
|
8
|
-
n = 8 # Board size
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Output Format
|
|
12
|
-
Return a list of queen positions where position[i] represents the column of the queen in row i.
|
|
13
|
-
|
|
14
|
-
## Example
|
|
15
|
-
For n=4, one solution is:
|
|
16
|
-
```
|
|
17
|
-
. Q . .
|
|
18
|
-
. . . Q
|
|
19
|
-
Q . . .
|
|
20
|
-
. . Q .
|
|
21
|
-
```
|
|
22
|
-
Represented as: [1, 3, 0, 2]
|
|
23
|
-
|
|
24
|
-
## Constraints
|
|
25
|
-
- Use CPMPy for constraint modeling
|
|
26
|
-
- All queens must be placed
|
|
27
|
-
- No two queens can be on the same row (automatic from representation)
|
|
28
|
-
- No two queens can be on the same column
|
|
29
|
-
- No two queens can be on the same diagonal
|
|
30
|
-
|
|
31
|
-
## Test Cases
|
|
32
|
-
```python
|
|
33
|
-
# n=4: Should find solution like [1, 3, 0, 2]
|
|
34
|
-
# n=8: Should find one of 92 possible solutions
|
|
35
|
-
# n=1: Should return [0]
|
|
36
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/cli.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/kernel.py
RENAMED
|
File without changes
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/src/agentic_python_coder/llm.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/coder/tests/test_todo_flag_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/clingo/sample_tasks/diagnosis.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agentic_python_coder-2.2.0 → agentic_python_coder-2.2.1}/examples/regex/sample_tasks/url_parsing.md
RENAMED
|
File without changes
|