Skip to content

Commit c3d3e68

Browse files
RafaelPoclaude
andauthored
feat: Add custom agent parameters (llm, iteration_budget, include_research) (#96)
Add support for the new agent endpoint parameters from the server: - `llm`: Specific LLM model (LLMEnumPublic enum with CLAUDE_4_5_HAIKU, GPT_5, etc.) - `iteration_budget`: Number of agent iterations (0-20) - `include_research`: Include research notes in response These can be used instead of `effort_level` presets by setting `effort_level=None` and providing all three custom parameters. Changes: - Regenerate OpenAPI client with new LLMEnumPublic enum - Update single_agent and agent_map to accept new parameters - Add tests verifying correct parameter passing to API Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6f179a7 commit c3d3e68

17 files changed

Lines changed: 647 additions & 78 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

src/everyrow/generated/api/operations/agent_map_operations_agent_map_post.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def sync_detailed(
7575
7676
Run an AI agent on each row in parallel to perform research and generate responses.
7777
78+
**Configuration options** (mutually exclusive):
79+
80+
1. **Use a preset** - set `effort_level` to `low`, `medium`, or `high`
81+
2. **Fully customize** - set `effort_level=null` and provide ALL of: `llm`, `iteration_budget`,
82+
`include_research`
83+
7884
Args:
7985
body (AgentMapOperation):
8086
@@ -106,6 +112,12 @@ def sync(
106112
107113
Run an AI agent on each row in parallel to perform research and generate responses.
108114
115+
**Configuration options** (mutually exclusive):
116+
117+
1. **Use a preset** - set `effort_level` to `low`, `medium`, or `high`
118+
2. **Fully customize** - set `effort_level=null` and provide ALL of: `llm`, `iteration_budget`,
119+
`include_research`
120+
109121
Args:
110122
body (AgentMapOperation):
111123
@@ -132,6 +144,12 @@ async def asyncio_detailed(
132144
133145
Run an AI agent on each row in parallel to perform research and generate responses.
134146
147+
**Configuration options** (mutually exclusive):
148+
149+
1. **Use a preset** - set `effort_level` to `low`, `medium`, or `high`
150+
2. **Fully customize** - set `effort_level=null` and provide ALL of: `llm`, `iteration_budget`,
151+
`include_research`
152+
135153
Args:
136154
body (AgentMapOperation):
137155
@@ -161,6 +179,12 @@ async def asyncio(
161179
162180
Run an AI agent on each row in parallel to perform research and generate responses.
163181
182+
**Configuration options** (mutually exclusive):
183+
184+
1. **Use a preset** - set `effort_level` to `low`, `medium`, or `high`
185+
2. **Fully customize** - set `effort_level=null` and provide ALL of: `llm`, `iteration_budget`,
186+
`include_research`
187+
164188
Args:
165189
body (AgentMapOperation):
166190

src/everyrow/generated/api/operations/single_agent_operations_single_agent_post.py

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ def sync_detailed(
7575
7676
Run a single AI agent to perform research and generate a response.
7777
78+
**Configuration options** (mutually exclusive):
79+
80+
1. **Use a preset** - set `effort_level` to one of:
81+
- `low`: Fast, minimal research (Gemini Flash, 0 iterations, no provenance)
82+
- `medium`: Balanced (Gemini Flash High, 5 iterations, with provenance)
83+
- `high`: Thorough research (Claude Opus, 10 iterations, with provenance)
84+
85+
2. **Fully customize** - set `effort_level=null` and provide ALL of:
86+
- `llm`: The LLM model to use
87+
- `iteration_budget`: Number of agent iterations (0-20)
88+
- `include_research`: Whether to include research notes
89+
90+
You cannot mix these approaches - either use a preset OR specify all custom parameters.
91+
7892
Args:
7993
body (SingleAgentOperation):
8094
@@ -106,6 +120,20 @@ def sync(
106120
107121
Run a single AI agent to perform research and generate a response.
108122
123+
**Configuration options** (mutually exclusive):
124+
125+
1. **Use a preset** - set `effort_level` to one of:
126+
- `low`: Fast, minimal research (Gemini Flash, 0 iterations, no provenance)
127+
- `medium`: Balanced (Gemini Flash High, 5 iterations, with provenance)
128+
- `high`: Thorough research (Claude Opus, 10 iterations, with provenance)
129+
130+
2. **Fully customize** - set `effort_level=null` and provide ALL of:
131+
- `llm`: The LLM model to use
132+
- `iteration_budget`: Number of agent iterations (0-20)
133+
- `include_research`: Whether to include research notes
134+
135+
You cannot mix these approaches - either use a preset OR specify all custom parameters.
136+
109137
Args:
110138
body (SingleAgentOperation):
111139
@@ -132,6 +160,20 @@ async def asyncio_detailed(
132160
133161
Run a single AI agent to perform research and generate a response.
134162
163+
**Configuration options** (mutually exclusive):
164+
165+
1. **Use a preset** - set `effort_level` to one of:
166+
- `low`: Fast, minimal research (Gemini Flash, 0 iterations, no provenance)
167+
- `medium`: Balanced (Gemini Flash High, 5 iterations, with provenance)
168+
- `high`: Thorough research (Claude Opus, 10 iterations, with provenance)
169+
170+
2. **Fully customize** - set `effort_level=null` and provide ALL of:
171+
- `llm`: The LLM model to use
172+
- `iteration_budget`: Number of agent iterations (0-20)
173+
- `include_research`: Whether to include research notes
174+
175+
You cannot mix these approaches - either use a preset OR specify all custom parameters.
176+
135177
Args:
136178
body (SingleAgentOperation):
137179
@@ -148,7 +190,6 @@ async def asyncio_detailed(
148190
)
149191

150192
response = await client.get_async_httpx_client().request(**kwargs)
151-
152193
return _build_response(client=client, response=response)
153194

154195

@@ -161,6 +202,20 @@ async def asyncio(
161202
162203
Run a single AI agent to perform research and generate a response.
163204
205+
**Configuration options** (mutually exclusive):
206+
207+
1. **Use a preset** - set `effort_level` to one of:
208+
- `low`: Fast, minimal research (Gemini Flash, 0 iterations, no provenance)
209+
- `medium`: Balanced (Gemini Flash High, 5 iterations, with provenance)
210+
- `high`: Thorough research (Claude Opus, 10 iterations, with provenance)
211+
212+
2. **Fully customize** - set `effort_level=null` and provide ALL of:
213+
- `llm`: The LLM model to use
214+
- `iteration_budget`: Number of agent iterations (0-20)
215+
- `include_research`: Whether to include research notes
216+
217+
You cannot mix these approaches - either use a preset OR specify all custom parameters.
218+
164219
Args:
165220
body (SingleAgentOperation):
166221
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

src/everyrow/generated/models/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
from .error_response_details_type_0 import ErrorResponseDetailsType0
1818
from .http_validation_error import HTTPValidationError
1919
from .insufficient_balance_error import InsufficientBalanceError
20+
from .llm_enum_public import LLMEnumPublic
2021
from .merge_operation import MergeOperation
2122
from .merge_operation_left_input_type_1_item import MergeOperationLeftInputType1Item
2223
from .merge_operation_left_input_type_2 import MergeOperationLeftInputType2
2324
from .merge_operation_right_input_type_1_item import MergeOperationRightInputType1Item
2425
from .merge_operation_right_input_type_2 import MergeOperationRightInputType2
26+
from .merge_operation_use_web_search_type_0 import MergeOperationUseWebSearchType0
2527
from .operation_response import OperationResponse
2628
from .public_effort_level import PublicEffortLevel
27-
from .public_llm import PublicLLM
2829
from .public_task_type import PublicTaskType
2930
from .rank_operation import RankOperation
3031
from .rank_operation_input_type_1_item import RankOperationInputType1Item
@@ -64,14 +65,15 @@
6465
"ErrorResponseDetailsType0",
6566
"HTTPValidationError",
6667
"InsufficientBalanceError",
68+
"LLMEnumPublic",
6769
"MergeOperation",
6870
"MergeOperationLeftInputType1Item",
6971
"MergeOperationLeftInputType2",
7072
"MergeOperationRightInputType1Item",
7173
"MergeOperationRightInputType2",
74+
"MergeOperationUseWebSearchType0",
7275
"OperationResponse",
7376
"PublicEffortLevel",
74-
"PublicLLM",
7577
"PublicTaskType",
7678
"RankOperation",
7779
"RankOperationInputType1Item",

src/everyrow/generated/models/agent_map_operation.py

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from attrs import define as _attrs_define
88
from attrs import field as _attrs_field
99

10+
from ..models.llm_enum_public import LLMEnumPublic
1011
from ..models.public_effort_level import PublicEffortLevel
11-
from ..models.public_llm import PublicLLM
1212
from ..types import UNSET, Unset
1313

1414
if TYPE_CHECKING:
@@ -31,19 +31,28 @@ class AgentMapOperation:
3131
session_id (None | Unset | UUID): Session ID. If not provided, a new session is auto-created for this task.
3232
response_schema (AgentMapOperationResponseSchemaType0 | None | Unset): JSON Schema for the response format. If
3333
not provided, use default answer schema.
34-
llm (PublicLLM | Unset):
35-
effort_level (PublicEffortLevel | Unset):
34+
llm (LLMEnumPublic | None | Unset): LLM to use for each agent. Required when effort_level is not set.
35+
effort_level (None | PublicEffortLevel | Unset): Effort level preset: low (quick), medium (balanced), high
36+
(thorough). Mutually exclusive with llm/iteration_budget/include_research - use either a preset or custom
37+
params, not both. If not specified, you must provide all individual parameters (llm, iteration_budget,
38+
include_research).
3639
join_with_input (bool | Unset): If True, merge agent output with input row. If False, output only agent results.
3740
Default: True.
41+
iteration_budget (int | None | Unset): Number of agent iterations per row (0-20). Required when effort_level is
42+
not set.
43+
include_research (bool | None | Unset): Include research notes in the response. Required when effort_level is
44+
not set.
3845
"""
3946

4047
input_: AgentMapOperationInputType2 | list[AgentMapOperationInputType1Item] | UUID
4148
task: str
4249
session_id: None | Unset | UUID = UNSET
4350
response_schema: AgentMapOperationResponseSchemaType0 | None | Unset = UNSET
44-
llm: PublicLLM | Unset = UNSET
45-
effort_level: PublicEffortLevel | Unset = UNSET
51+
llm: LLMEnumPublic | None | Unset = UNSET
52+
effort_level: None | PublicEffortLevel | Unset = UNSET
4653
join_with_input: bool | Unset = True
54+
iteration_budget: int | None | Unset = UNSET
55+
include_research: bool | None | Unset = UNSET
4756
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
4857

4958
def to_dict(self) -> dict[str, Any]:
@@ -79,16 +88,36 @@ def to_dict(self) -> dict[str, Any]:
7988
else:
8089
response_schema = self.response_schema
8190

82-
llm: str | Unset = UNSET
83-
if not isinstance(self.llm, Unset):
91+
llm: None | str | Unset
92+
if isinstance(self.llm, Unset):
93+
llm = UNSET
94+
elif isinstance(self.llm, LLMEnumPublic):
8495
llm = self.llm.value
96+
else:
97+
llm = self.llm
8598

86-
effort_level: str | Unset = UNSET
87-
if not isinstance(self.effort_level, Unset):
99+
effort_level: None | str | Unset
100+
if isinstance(self.effort_level, Unset):
101+
effort_level = UNSET
102+
elif isinstance(self.effort_level, PublicEffortLevel):
88103
effort_level = self.effort_level.value
104+
else:
105+
effort_level = self.effort_level
89106

90107
join_with_input = self.join_with_input
91108

109+
iteration_budget: int | None | Unset
110+
if isinstance(self.iteration_budget, Unset):
111+
iteration_budget = UNSET
112+
else:
113+
iteration_budget = self.iteration_budget
114+
115+
include_research: bool | None | Unset
116+
if isinstance(self.include_research, Unset):
117+
include_research = UNSET
118+
else:
119+
include_research = self.include_research
120+
92121
field_dict: dict[str, Any] = {}
93122
field_dict.update(self.additional_properties)
94123
field_dict.update(
@@ -107,6 +136,10 @@ def to_dict(self) -> dict[str, Any]:
107136
field_dict["effort_level"] = effort_level
108137
if join_with_input is not UNSET:
109138
field_dict["join_with_input"] = join_with_input
139+
if iteration_budget is not UNSET:
140+
field_dict["iteration_budget"] = iteration_budget
141+
if include_research is not UNSET:
142+
field_dict["include_research"] = include_research
110143

111144
return field_dict
112145

@@ -184,22 +217,60 @@ def _parse_response_schema(data: object) -> AgentMapOperationResponseSchemaType0
184217

185218
response_schema = _parse_response_schema(d.pop("response_schema", UNSET))
186219

187-
_llm = d.pop("llm", UNSET)
188-
llm: PublicLLM | Unset
189-
if isinstance(_llm, Unset):
190-
llm = UNSET
191-
else:
192-
llm = PublicLLM(_llm)
220+
def _parse_llm(data: object) -> LLMEnumPublic | None | Unset:
221+
if data is None:
222+
return data
223+
if isinstance(data, Unset):
224+
return data
225+
try:
226+
if not isinstance(data, str):
227+
raise TypeError()
228+
llm_type_0 = LLMEnumPublic(data)
193229

194-
_effort_level = d.pop("effort_level", UNSET)
195-
effort_level: PublicEffortLevel | Unset
196-
if isinstance(_effort_level, Unset):
197-
effort_level = UNSET
198-
else:
199-
effort_level = PublicEffortLevel(_effort_level)
230+
return llm_type_0
231+
except (TypeError, ValueError, AttributeError, KeyError):
232+
pass
233+
return cast(LLMEnumPublic | None | Unset, data)
234+
235+
llm = _parse_llm(d.pop("llm", UNSET))
236+
237+
def _parse_effort_level(data: object) -> None | PublicEffortLevel | Unset:
238+
if data is None:
239+
return data
240+
if isinstance(data, Unset):
241+
return data
242+
try:
243+
if not isinstance(data, str):
244+
raise TypeError()
245+
effort_level_type_0 = PublicEffortLevel(data)
246+
247+
return effort_level_type_0
248+
except (TypeError, ValueError, AttributeError, KeyError):
249+
pass
250+
return cast(None | PublicEffortLevel | Unset, data)
251+
252+
effort_level = _parse_effort_level(d.pop("effort_level", UNSET))
200253

201254
join_with_input = d.pop("join_with_input", UNSET)
202255

256+
def _parse_iteration_budget(data: object) -> int | None | Unset:
257+
if data is None:
258+
return data
259+
if isinstance(data, Unset):
260+
return data
261+
return cast(int | None | Unset, data)
262+
263+
iteration_budget = _parse_iteration_budget(d.pop("iteration_budget", UNSET))
264+
265+
def _parse_include_research(data: object) -> bool | None | Unset:
266+
if data is None:
267+
return data
268+
if isinstance(data, Unset):
269+
return data
270+
return cast(bool | None | Unset, data)
271+
272+
include_research = _parse_include_research(d.pop("include_research", UNSET))
273+
203274
agent_map_operation = cls(
204275
input_=input_,
205276
task=task,
@@ -208,6 +279,8 @@ def _parse_response_schema(data: object) -> AgentMapOperationResponseSchemaType0
208279
llm=llm,
209280
effort_level=effort_level,
210281
join_with_input=join_with_input,
282+
iteration_budget=iteration_budget,
283+
include_research=include_research,
211284
)
212285

213286
agent_map_operation.additional_properties = d

0 commit comments

Comments
 (0)