diff --git a/openapi/agent-sdk.json b/openapi/agent-sdk.json index bc8c1dec..212faaa8 100644 --- a/openapi/agent-sdk.json +++ b/openapi/agent-sdk.json @@ -2462,6 +2462,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "APIBasedCritic", @@ -2610,6 +2621,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "APIBasedCritic", @@ -3071,7 +3093,7 @@ "llm" ], "title": "Agent", - "description": "Main agent implementation for OpenHands.\n\nThe Agent class provides the core functionality for running AI agents that can\ninteract with tools, process messages, and execute actions. It inherits from\nAgentBase and implements the agent execution logic.\n\nExample:\n >>> from openhands.sdk import LLM, Agent, Tool\n >>> llm = LLM(model=\"claude-sonnet-4-20250514\", api_key=SecretStr(\"key\"))\n >>> tools = [Tool(name=\"TerminalTool\"), Tool(name=\"FileEditorTool\")]\n >>> agent = Agent(llm=llm, tools=tools)" + "description": "Main agent implementation for OpenHands.\n\nThe Agent class provides the core functionality for running AI agents that can\ninteract with tools, process messages, and execute actions. It inherits from\nAgentBase and implements the agent execution logic. Critic-related functionality\nis provided by CriticMixin.\n\nExample:\n >>> from openhands.sdk import LLM, Agent, Tool\n >>> llm = LLM(model=\"claude-sonnet-4-20250514\", api_key=SecretStr(\"key\"))\n >>> tools = [Tool(name=\"TerminalTool\"), Tool(name=\"FileEditorTool\")]\n >>> agent = Agent(llm=llm, tools=tools)" }, "Agent-Output": { "properties": { @@ -3265,7 +3287,7 @@ "kind" ], "title": "Agent", - "description": "Main agent implementation for OpenHands.\n\nThe Agent class provides the core functionality for running AI agents that can\ninteract with tools, process messages, and execute actions. It inherits from\nAgentBase and implements the agent execution logic.\n\nExample:\n >>> from openhands.sdk import LLM, Agent, Tool\n >>> llm = LLM(model=\"claude-sonnet-4-20250514\", api_key=SecretStr(\"key\"))\n >>> tools = [Tool(name=\"TerminalTool\"), Tool(name=\"FileEditorTool\")]\n >>> agent = Agent(llm=llm, tools=tools)" + "description": "Main agent implementation for OpenHands.\n\nThe Agent class provides the core functionality for running AI agents that can\ninteract with tools, process messages, and execute actions. It inherits from\nAgentBase and implements the agent execution logic. Critic-related functionality\nis provided by CriticMixin.\n\nExample:\n >>> from openhands.sdk import LLM, Agent, Tool\n >>> llm = LLM(model=\"claude-sonnet-4-20250514\", api_key=SecretStr(\"key\"))\n >>> tools = [Tool(name=\"TerminalTool\"), Tool(name=\"FileEditorTool\")]\n >>> agent = Agent(llm=llm, tools=tools)" }, "AgentBase-Input": { "$ref": "#/components/schemas/Agent-Input" @@ -3485,6 +3507,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "AgentFinishedCritic", @@ -3507,6 +3540,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "AgentFinishedCritic", @@ -5516,6 +5560,12 @@ "$ref": "#/components/schemas/SecretRegistry-Output", "description": "Registry for handling secrets and sensitive data" }, + "agent_state": { + "additionalProperties": true, + "type": "object", + "title": "Agent State", + "description": "Dictionary for agent-specific runtime state that persists across iterations. Agents can store feature-specific state using string keys. To trigger autosave, always reassign: state.agent_state = {**state.agent_state, key: value}. See https://docs.openhands.dev/sdk/guides/convo-persistence#how-state-persistence-works" + }, "title": { "anyOf": [ { @@ -6000,6 +6050,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "EmptyPatchCritic", @@ -6022,6 +6083,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "EmptyPatchCritic", @@ -7266,6 +7338,28 @@ "title": "InputMetadata", "description": "Metadata for task skill inputs." }, + "IterativeRefinementConfig": { + "properties": { + "success_threshold": { + "type": "number", + "maximum": 1.0, + "minimum": 0.0, + "title": "Success Threshold", + "description": "Score threshold (0-1) to consider task successful.", + "default": 0.6 + }, + "max_iterations": { + "type": "integer", + "minimum": 1.0, + "title": "Max Iterations", + "description": "Maximum number of iterations before giving up.", + "default": 3 + } + }, + "type": "object", + "title": "IterativeRefinementConfig", + "description": "Configuration for iterative refinement based on critic feedback.\n\nWhen attached to a CriticBase, the Conversation.run() method will\nautomatically retry the task if the critic score is below the threshold.\n\nExample:\n critic = APIBasedCritic(\n server_url=\"...\",\n api_key=\"...\",\n model_name=\"critic\",\n iterative_refinement=IterativeRefinementConfig(\n success_threshold=0.7,\n max_iterations=3,\n ),\n )\n agent = Agent(llm=llm, tools=tools, critic=critic)\n conversation = Conversation(agent=agent, workspace=workspace)\n conversation.send_message(\"Create a calculator module...\")\n conversation.run() # Will automatically retry if critic score < 0.7" + }, "KeywordTrigger": { "properties": { "type": { @@ -8946,6 +9040,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "PassCritic", @@ -8968,6 +9073,17 @@ "description": "When to run critic evaluation:\n- 'finish_and_message': Evaluate on FinishAction and agent MessageEvent (default, minimal performance impact)\n- 'all_actions': Evaluate after every agent action (WARNING: significantly slower due to API calls on each action)", "default": "finish_and_message" }, + "iterative_refinement": { + "anyOf": [ + { + "$ref": "#/components/schemas/IterativeRefinementConfig" + }, + { + "type": "null" + } + ], + "description": "Optional configuration for iterative refinement. When set, Conversation.run() will automatically retry the task if the critic score is below the success_threshold, up to max_iterations." + }, "kind": { "type": "string", "const": "PassCritic", @@ -9928,7 +10044,7 @@ "version": { "type": "string", "title": "Version", - "default": "1.11.1" + "default": "1.11.2" }, "docs": { "type": "string",