Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/consts/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ class AgentInfoRequest(BaseModel):
business_description: Optional[str] = None
author: Optional[str] = None
model_ids: Optional[List[int]] = None
max_steps: Optional[int] = Field(default=None, ge=1, le=30)
max_steps: Optional[int] = Field(default=None, ge=1)
requested_output_tokens: Optional[int] = Field(default=None, gt=0)
provide_run_summary: Optional[bool] = None
duty_prompt: Optional[str] = None
Expand Down
4 changes: 2 additions & 2 deletions backend/services/agent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2241,9 +2241,9 @@ async def import_agent_by_agent_id(
enabled=True,
params=tool.params))
# check the validity of the agent parameters
if import_agent_info.max_steps <= 0 or import_agent_info.max_steps > 30:
if import_agent_info.max_steps <= 0:
raise ValueError(
f"Invalid max steps: {import_agent_info.max_steps}. max steps must be greater than 0 and less than 30.")
f"Invalid max steps: {import_agent_info.max_steps}. max steps must be greater than 0.")
if not import_agent_info.name.isidentifier():
raise ValueError(
f"Invalid agent name: {import_agent_info.name}. agent name must be a valid python variable name.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,14 +1046,12 @@ export default function AgentGenerateDetail({}) {
{
type: "number",
min: 1,
max: 30,
message: t("businessLogic.config.maxSteps"),
},
]}
>
<InputNumber
min={1}
max={30}
style={{ width: "100%" }}
onBlur={() => {
const value = form.getFieldValue("mainAgentMaxStep");
Expand Down
2 changes: 1 addition & 1 deletion sdk/nexent/core/agents/agent_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class AgentConfig(BaseModel):
description: str = Field(description="Agent description")
prompt_templates: Optional[Dict[str, Any]] = Field(description="Prompt templates", default=None)
tools: List[ToolConfig] = Field(description="List of tool information")
max_steps: int = Field(description="Maximum number of steps for current Agent", default=15, ge=1, le=30)
max_steps: int = Field(description="Maximum number of steps for current Agent", default=15, ge=1)
requested_output_tokens: Optional[int] = Field(
description=(
"Per-agent W2 output reserve override. None means inherit the "
Expand Down
2 changes: 1 addition & 1 deletion test/backend/services/test_agent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10863,7 +10863,7 @@ async def test_import_agent_by_agent_id_invalid_max_steps():
mock_agent_info.description = "desc"
mock_agent_info.business_description = "biz"
mock_agent_info.author = "author"
mock_agent_info.max_steps = 35 # Too high (> 30)
mock_agent_info.max_steps = -1 # Invalid: must be > 0
mock_agent_info.provide_run_summary = True
mock_agent_info.duty_prompt = "duty"
mock_agent_info.constraint_prompt = "constraint"
Expand Down
29 changes: 18 additions & 11 deletions test/sdk/core/agents/test_agent_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,17 +1238,8 @@ def test_agent_config_max_steps_boundary(self):
)
assert config_max.max_steps == 30

def test_agent_config_max_steps_rejects_out_of_bounds(self):
"""Test AgentConfig rejects max_steps values outside 1-30 range."""
with pytest.raises(Exception):
agent_model_module.AgentConfig(
name="too_high",
description="Too high steps",
tools=[],
model_name="test",
max_steps=31
)

def test_agent_config_max_steps_rejects_below_lower_bound(self):
"""Test AgentConfig rejects max_steps values below the lower bound (1)."""
with pytest.raises(Exception):
agent_model_module.AgentConfig(
name="too_low",
Expand All @@ -1258,6 +1249,22 @@ def test_agent_config_max_steps_rejects_out_of_bounds(self):
max_steps=0
)

def test_agent_config_max_steps_accepts_above_design_max(self):
"""Test AgentConfig accepts max_steps values above the design-maximum (30).

The model enforces ge=1 (lower bound) but does not enforce an upper bound.
Values above 30 are silently accepted; callers are responsible for enforcing
application-level limits if needed.
"""
config = agent_model_module.AgentConfig(
name="above_design_max",
description="Steps above 30",
tools=[],
model_name="test",
max_steps=31
)
assert config.max_steps == 31


class TestAgentVerificationConfig:
"""Tests for layered ReAct verification configuration."""
Expand Down
Loading