Skip to content

Commit c241f8a

Browse files
committed
Remove unused backend LLM setting
1 parent 0edd6f4 commit c241f8a

14 files changed

Lines changed: 23 additions & 60 deletions

‎python_agent_harness/agent.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def safe_delta(text: str) -> None:
452452
)
453453
# sub-agent runs use their own LLM when one is configured
454454
# (a per-invocation clone of session.subagent_client,
455-
# mirroring gptel-agent-harness-subagent-model/-backend);
455+
# mirroring gptel-agent-harness-subagent-model);
456456
# everything unset inherits the main agent's settings, so
457457
# the sub-agent path is identical when no separate LLM is
458458
# configured

‎python_agent_harness/cli.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def make_session(
5454
config_path=config_path,
5555
)
5656
# A separate client for sub-agent requests only when a different
57-
# LLM is configured (mirrors gptel-agent-harness-subagent-model /
58-
# -backend); otherwise the sub-agent shares the main client.
57+
# LLM is configured (mirrors gptel-agent-harness-subagent-model);
58+
# otherwise the sub-agent shares the main client.
5959
subagent_client = None
6060
if any(
6161
subagent_settings[k] != settings[k] for k in ("base_url", "api_key", "model", "timeout")
@@ -101,7 +101,6 @@ def make_session(
101101
project_dir=abs_project,
102102
client=client,
103103
model=model,
104-
backend=settings["backend"],
105104
system_prompt=system_prompt,
106105
subagent_system_prompt=subagent_system_prompt,
107106
temperature=settings["temperature"],
@@ -176,7 +175,7 @@ def cmd_config(args: argparse.Namespace) -> int:
176175
print(f"config file: {path}")
177176
if not path.exists():
178177
print("(file does not exist yet — run `python-agent-harness config --init` to create it)")
179-
for key in ("base_url", "model", "backend"):
178+
for key in ("base_url", "model"):
180179
print(f"{key}: {settings[key]}")
181180
print(f"api_key: {config.mask_secret(settings['api_key'])}")
182181
print(f"temperature: {settings['temperature']}")

‎python_agent_harness/config.py‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
"base_url": "https://api.openai.com/v1",
169169
"api_key": None,
170170
"model": "gpt-5-mini",
171-
"backend": "OpenAI-compatible",
172171
"temperature": TEMPERATURE,
173172
"max_tokens": MAX_TOKENS,
174173
"timeout": 600.0,
@@ -182,8 +181,7 @@
182181
}
183182

184183
# Sub-agent LLM overrides: every key defaults to None, meaning "inherit
185-
# the main LLM setting" (mirrors gptel-agent-harness-subagent-model /
186-
# -backend). Only the keys the user actually sets differ from the main
184+
# the main LLM setting" (mirrors gptel-agent-harness-subagent-model).
187185
# agent's LLM. ``profile`` references a named profile from the
188186
# ``models`` section: its settings are applied on top of any explicit
189187
# subagent_llm keys (profile wins), and unset keys still inherit the
@@ -193,7 +191,6 @@
193191
"base_url": None,
194192
"api_key": None,
195193
"model": None,
196-
"backend": None,
197194
"temperature": None,
198195
"max_tokens": None,
199196
"timeout": None,
@@ -264,14 +261,12 @@
264261
"base_url": "OPENAI_BASE_URL",
265262
"api_key": "OPENAI_API_KEY",
266263
"model": "OPENAI_MODEL",
267-
"backend": "OPENAI_BACKEND",
268264
}
269265

270266
_SUBAGENT_ENV_OVERRIDES = {
271267
"base_url": "OPENAI_SUBAGENT_BASE_URL",
272268
"api_key": "OPENAI_SUBAGENT_API_KEY",
273269
"model": "OPENAI_SUBAGENT_MODEL",
274-
"backend": "OPENAI_SUBAGENT_BACKEND",
275270
}
276271

277272

@@ -320,7 +315,6 @@ def load_llm_config(path: str | os.PathLike | None = None) -> dict:
320315
"base_url",
321316
"api_key",
322317
"model",
323-
"backend",
324318
"temperature",
325319
"max_tokens",
326320
"timeout",
@@ -342,7 +336,7 @@ def load_subagent_llm_config(
342336
) -> dict:
343337
"""Resolve sub-agent LLM settings; unset keys inherit ``main``.
344338
345-
Mirrors gptel-agent-harness-subagent-model/-backend: sub-agents
339+
Mirrors gptel-agent-harness-subagent-model: sub-agents
346340
(the Agent tool) use their own LLM when configured, otherwise the
347341
main agent's. Precedence: ``main`` settings < config file
348342
``subagent_llm`` object < referenced ``models`` profile (when
@@ -379,7 +373,6 @@ def load_subagent_llm_config(
379373
"base_url",
380374
"api_key",
381375
"model",
382-
"backend",
383376
"temperature",
384377
"max_tokens",
385378
"timeout",

‎python_agent_harness/persistence.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def __init__(
107107
self,
108108
project_dir: str,
109109
model: str,
110-
backend: str,
111110
system_prompt: str | None = None,
112111
temperature: float | None = None,
113112
max_tokens: int | None = None,
@@ -116,7 +115,6 @@ def __init__(
116115
) -> None:
117116
self.project_dir = project_dir
118117
self.model = model
119-
self.backend = backend
120118
self.system_prompt = system_prompt
121119
self.temperature = temperature
122120
self.max_tokens = max_tokens
@@ -173,7 +171,6 @@ def metadata_block(self) -> str:
173171
pairs = [
174172
("python-agent-harness--project-dir", self.project_dir),
175173
("gptel-model", self.model),
176-
("gptel--backend-name", self.backend),
177174
("gptel-system-prompt", self.system_prompt),
178175
("gptel-temperature", self.temperature),
179176
("gptel-max-tokens", self.max_tokens),

‎python_agent_harness/session.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def __init__(
7171
project_dir: str,
7272
client: Client,
7373
model: str,
74-
backend: str = "OpenAI-compatible",
7574
system_prompt: str | None = None,
7675
subagent_system_prompt: str | None = None,
7776
temperature: float = config.TEMPERATURE,
@@ -96,7 +95,6 @@ def __init__(
9695
self.project_dir = project_dir
9796
self.client = client
9897
self.model = model
99-
self.backend = backend
10098
self.system_prompt = system_prompt
10199
self.subagent_system_prompt = subagent_system_prompt
102100
self.temperature = temperature
@@ -113,7 +111,7 @@ def __init__(
113111
# Sub-agent LLM: a dedicated client (base_url/api_key/model/
114112
# timeout) and per-request options when a different LLM is
115113
# configured for sub-agents (mirrors gptel-agent-harness-
116-
# subagent-model/-backend); every unset option inherits the
114+
# subagent-model); every unset option inherits the
117115
# main agent's value. The sub-agent loop never uses this
118116
# client directly — each Agent tool invocation clones it
119117
# (see run_subagent) so concurrent sub-agents never share a
@@ -161,7 +159,6 @@ def __init__(
161159
self.store = SessionPersistence(
162160
project_dir=project_dir,
163161
model=model,
164-
backend=backend,
165162
system_prompt=system_prompt,
166163
temperature=temperature,
167164
max_tokens=max_tokens,
@@ -659,7 +656,6 @@ def switch_model(self, name: str) -> tuple[bool, str]:
659656
"base_url": self.client.base_url,
660657
"api_key": self.client.api_key,
661658
"model": self.model,
662-
"backend": self.backend,
663659
"temperature": self.temperature,
664660
"max_tokens": self.max_tokens,
665661
"timeout": self.client.timeout,
@@ -673,7 +669,6 @@ def switch_model(self, name: str) -> tuple[bool, str]:
673669
"base_url",
674670
"api_key",
675671
"model",
676-
"backend",
677672
"temperature",
678673
"max_tokens",
679674
"timeout",
@@ -690,8 +685,6 @@ def switch_model(self, name: str) -> tuple[bool, str]:
690685
# the calibration factor is tokenizer-specific: a factor tuned
691686
# to the previous model must not skew estimates for the new one
692687
self.calibrator.reset()
693-
self.backend = merged["backend"]
694-
self.store.backend = merged["backend"]
695688
self.temperature = merged["temperature"]
696689
self.max_tokens = merged["max_tokens"]
697690
if hasattr(self.client, "set_timeout"):

‎python_agent_harness/tools/agent_tool.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
long-running sub-agent never blocks the parent's sequential tool loop.
77
88
Sub-agents run the same agent loop with a fresh loop instance; their
9-
backend/model can be overridden (see config). Results flow back to the
9+
model can be overridden (see config). Results flow back to the
1010
parent as a single tool result string. Errors are contained: an
1111
unexpected sub-agent response becomes an error string fed to the parent,
1212
never a crash.

‎tests/agent/agent_test_utils.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def __init__(self, project_dir="/tmp/fakeproj", model_profiles=None, llm_setting
110110
self.store = SessionPersistence(
111111
project_dir=project_dir,
112112
model=self.model,
113-
backend=self.backend,
114113
system_prompt=self.system_prompt,
115114
temperature=self.temperature,
116115
max_tokens=self.max_tokens,

‎tests/test_cli.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ class TestMakeSessionPromptDefaults(unittest.TestCase):
2020
"OPENAI_BASE_URL",
2121
"OPENAI_API_KEY",
2222
"OPENAI_MODEL",
23-
"OPENAI_BACKEND",
2423
"OPENAI_SUBAGENT_BASE_URL",
2524
"OPENAI_SUBAGENT_API_KEY",
2625
"OPENAI_SUBAGENT_MODEL",
27-
"OPENAI_SUBAGENT_BACKEND",
2826
]
2927

3028
def setUp(self):
@@ -178,7 +176,7 @@ def test_subagent_stream_inherits_main_without_cli_flag(self):
178176

179177
def test_subagent_llm_inherits_main_client_by_default(self):
180178
"""Without subagent_llm overrides, the sub-agent shares the
181-
main client (mirrors gptel-agent-harness: nil backend/model
179+
main client (mirrors gptel-agent-harness: nil model overrides
182180
inherit the main agent's)."""
183181
session = cli.make_session(self._tmp.name, config_path=self._config_path)
184182
try:

‎tests/test_config.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
"OPENAI_BASE_URL",
1212
"OPENAI_API_KEY",
1313
"OPENAI_MODEL",
14-
"OPENAI_BACKEND",
1514
"PYTHON_AGENT_HARNESS_CONFIG",
1615
"OPENAI_SUBAGENT_BASE_URL",
1716
"OPENAI_SUBAGENT_API_KEY",
1817
"OPENAI_SUBAGENT_MODEL",
19-
"OPENAI_SUBAGENT_BACKEND",
2018
]
2119

2220

@@ -49,7 +47,6 @@ def test_file_overrides_defaults(self):
4947
'"base_url": "https://api.example.com/v1", '
5048
'"api_key": "sk-test", '
5149
'"model": "custom-model", '
52-
'"backend": "Example", '
5350
'"temperature": 0.2, '
5451
'"max_tokens": 2048, '
5552
'"timeout": 30.0, '
@@ -60,7 +57,6 @@ def test_file_overrides_defaults(self):
6057
self.assertEqual(settings["base_url"], "https://api.example.com/v1")
6158
self.assertEqual(settings["api_key"], "sk-test")
6259
self.assertEqual(settings["model"], "custom-model")
63-
self.assertEqual(settings["backend"], "Example")
6460
self.assertEqual(settings["temperature"], 0.2)
6561
self.assertEqual(settings["max_tokens"], 2048)
6662
self.assertEqual(settings["timeout"], 30.0)
@@ -327,7 +323,7 @@ def test_get_context_window_no_file(self):
327323

328324
class TestSubagentLlmConfig(unittest.TestCase):
329325
"""Sub-agent LLM settings: unset keys inherit the main settings
330-
(mirrors gptel-agent-harness-subagent-model/-backend)."""
326+
(mirrors gptel-agent-harness-subagent-model)."""
331327

332328
def setUp(self):
333329
self._saved = {k: os.environ.get(k) for k in ENV_KEYS}
@@ -345,7 +341,6 @@ def tearDown(self):
345341
"base_url": "https://api.main.example/v1",
346342
"api_key": "sk-main",
347343
"model": "big-model",
348-
"backend": "Main",
349344
"temperature": 0.0,
350345
"max_tokens": None,
351346
"timeout": 600.0,

‎tests/test_persistence.py‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def test_metadata_roundtrip(self):
2828
store = SessionPersistence(
2929
project_dir="/tmp/proj",
3030
model="deepseek-v4",
31-
backend="DeepSeek",
3231
system_prompt="be helpful",
3332
temperature=0.7,
3433
max_tokens=8192,
@@ -47,7 +46,6 @@ def test_round_times_persisted_in_metadata(self):
4746
store = SessionPersistence(
4847
project_dir="/tmp/proj",
4948
model="deepseek-v4",
50-
backend="DeepSeek",
5149
round_times=[1700000000.0, 1700000100.5],
5250
)
5351
meta = store.metadata_block()
@@ -59,7 +57,7 @@ def test_round_times_persisted_in_metadata(self):
5957
self.assertEqual(times, [1700000000.0, 1700000100.5])
6058

6159
def test_round_times_absent_when_empty(self):
62-
store = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
60+
store = SessionPersistence(project_dir="/tmp/proj", model="m")
6361
self.assertNotIn("round-times", store.metadata_block())
6462

6563
def test_save_and_restore_flow(self):
@@ -70,7 +68,6 @@ def test_save_and_restore_flow(self):
7068
store = SessionPersistence(
7169
project_dir=d,
7270
model="m",
73-
backend="b",
7471
)
7572
path = store.save("hello world")
7673
self.assertTrue(path)
@@ -88,7 +85,7 @@ def test_apply_title_renames(self):
8885
old_dir = config.SESSION_DIR
8986
config.SESSION_DIR = __import__("pathlib").Path(d)
9087
try:
91-
store = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
88+
store = SessionPersistence(project_dir="/tmp/proj", model="m")
9289
store.save("x")
9390
store.apply_title("My Great Session")
9491
self.assertTrue(os.path.exists(store.file_path))
@@ -110,9 +107,9 @@ def test_same_second_save_collision_keeps_both(self):
110107
old_dir = config.SESSION_DIR
111108
config.SESSION_DIR = __import__("pathlib").Path(d)
112109
try:
113-
s1 = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
110+
s1 = SessionPersistence(project_dir="/tmp/proj", model="m")
114111
p1 = s1.save("one")
115-
s2 = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
112+
s2 = SessionPersistence(project_dir="/tmp/proj", model="m")
116113
p2 = s2.save("two")
117114
self.assertNotEqual(p1, p2)
118115
self.assertTrue(os.path.exists(p1))
@@ -136,11 +133,11 @@ def test_title_collision_keeps_both_files(self):
136133
old_dir = config.SESSION_DIR
137134
config.SESSION_DIR = __import__("pathlib").Path(d)
138135
try:
139-
s1 = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
136+
s1 = SessionPersistence(project_dir="/tmp/proj", model="m")
140137
s1.save("one")
141138
s1.apply_title("Same Title")
142139
t1 = s1.file_path
143-
s2 = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
140+
s2 = SessionPersistence(project_dir="/tmp/proj", model="m")
144141
s2.save("two")
145142
s2.apply_title("Same Title")
146143
t2 = s2.file_path
@@ -155,14 +152,14 @@ def test_save_returns_none_without_file_path(self):
155152
must return None instead of writing anywhere."""
156153
import unittest.mock as mock
157154

158-
store = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
155+
store = SessionPersistence(project_dir="/tmp/proj", model="m")
159156
with mock.patch.object(SessionPersistence, "session_file", return_value=None):
160157
self.assertIsNone(store.save("hello"))
161158

162159
def test_apply_title_requires_nonempty_sanitized_title(self):
163160
"""A title that sanitizes to '' must not rename anything and must
164161
not be recorded."""
165-
store = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
162+
store = SessionPersistence(project_dir="/tmp/proj", model="m")
166163
store.apply_title(" --- ") # sanitizes to ""
167164
self.assertIsNone(store.title)
168165
self.assertIsNone(store.file_path)
@@ -180,7 +177,7 @@ def test_apply_title_oserror_keeps_original_file(self):
180177
old_dir = config.SESSION_DIR
181178
config.SESSION_DIR = __import__("pathlib").Path(d)
182179
try:
183-
store = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
180+
store = SessionPersistence(project_dir="/tmp/proj", model="m")
184181
store.save("x")
185182
before = store.file_path
186183
with mock.patch(
@@ -211,7 +208,7 @@ def test_concurrent_save_and_apply_title_do_not_split(self):
211208
old_dir = config.SESSION_DIR
212209
config.SESSION_DIR = __import__("pathlib").Path(d)
213210
try:
214-
store = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
211+
store = SessionPersistence(project_dir="/tmp/proj", model="m")
215212
store.save("old content")
216213
before = store.file_path
217214

@@ -298,9 +295,9 @@ def test_list_sessions_newest_first(self):
298295
old_dir = config.SESSION_DIR
299296
config.SESSION_DIR = Path(d)
300297
try:
301-
s1 = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
298+
s1 = SessionPersistence(project_dir="/tmp/proj", model="m")
302299
p1 = s1.save("one")
303-
s2 = SessionPersistence(project_dir="/tmp/proj", model="m", backend="b")
300+
s2 = SessionPersistence(project_dir="/tmp/proj", model="m")
304301
p2 = s2.save("two")
305302
os.utime(p1, (1_000_000, 1_000_000)) # make p1 the older file
306303
sessions = SessionPersistence.list_sessions()

0 commit comments

Comments
 (0)