Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
api_key=SecretStr(api_key),
)
conversation.llm_registry.add(second_llm)
completion_response = second_llm.completion(
second_llm.completion(
messages=[Message(role="user", content=[TextContent(text="echo 'More spend!'")])]
)

Expand Down
2 changes: 1 addition & 1 deletion examples/01_standalone_sdk/28_ask_agent_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def timestamp() -> str:
thread.join()

# Step 5: Verify conversation state wasn't affected
final_event_count = len(conversation.state.events)
len(conversation.state.events) # Just verify we can access it
# Step 6: Ask a final question after conversation completion
print(f"\n[{timestamp()}] Asking final question after completion...")
final_response = conversation.ask_agent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __enter__(self):

raise RuntimeError(f"Server failed to start after {max_retries} seconds")

def __exit__(self, exc_type, exc_val, exc_tb):
def __exit__(self, exc_type, _exc_val, _exc_tb):
"""Stop the API server subprocess."""
if self.process:
print("Stopping API server...")
Expand Down
7 changes: 3 additions & 4 deletions openhands-sdk/openhands/sdk/agent/acp_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ async def create_terminal(
args: list[str] | None = None,
cwd: str | None = None,
env: Any = None,
output_byte_limit: int | None = None,
**kwargs: Any,
) -> Any:
raise NotImplementedError("ACP server handles terminal operations")
Expand Down Expand Up @@ -333,7 +332,7 @@ class ACPAgent(AgentBase):
_session_id: str | None = PrivateAttr(default=None)
_process: Any = PrivateAttr(default=None) # asyncio subprocess
_client: Any = PrivateAttr(default=None) # _OpenHandsACPBridge
_filtered_reader: Any = PrivateAttr(default=None) # StreamReader

_closed: bool = PrivateAttr(default=False)
_working_dir: str = PrivateAttr(default="")

Expand Down Expand Up @@ -481,10 +480,10 @@ async def _init() -> tuple[Any, Any, Any, str]:
response = await conn.new_session(cwd=working_dir)
session_id = response.session_id

return conn, process, filtered_reader, session_id
return conn, process, session_id

result = self._executor.run_async(_init)
self._conn, self._process, self._filtered_reader, self._session_id = result
self._conn, self._process, self._session_id = result
self._working_dir = working_dir

def step(
Expand Down
2 changes: 1 addition & 1 deletion openhands-sdk/openhands/sdk/conversation/fifo_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __enter__(self: Self) -> Self:
self.acquire()
return self

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
def __exit__(self, exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:
"""Context manager exit."""
self.release()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def model_dump_json(self, **kwargs):
def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
def __exit__(self, exc_type, _exc_val, _exc_tb):
pass


Expand Down
2 changes: 1 addition & 1 deletion openhands-sdk/openhands/sdk/conversation/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def __enter__(self: Self) -> Self:
self._lock.acquire()
return self

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
def __exit__(self, exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:
"""Context manager exit."""
self._lock.release()

Expand Down
1 change: 0 additions & 1 deletion openhands-sdk/openhands/sdk/critic/impl/api/critic.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def evaluate(
"APIBasedCritic requires tools to be defined in SystemPromptEvent. "
"Ensure your agent configuration includes tool definitions."
)
raise ValueError("Tools are required for APIBasedCritic evaluation")

# This will only retain events that are kept by the condenser
view = View.from_events(events)
Expand Down
2 changes: 1 addition & 1 deletion openhands-sdk/openhands/sdk/security/grayswan/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def validate_thresholds(self) -> GraySwanAnalyzer:
)
return self

def model_post_init(self, __context: Any) -> None:
def model_post_init(self, _context: Any) -> None:
"""Initialize the analyzer after model creation."""
# Resolve API key from environment if not provided
if self.api_key is None:
Expand Down
2 changes: 1 addition & 1 deletion openhands-sdk/openhands/sdk/utils/async_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def close(self):
def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
def __exit__(self, exc_type, _exc_val, _exc_tb):
self.close()
return False

Expand Down
6 changes: 3 additions & 3 deletions openhands-sdk/openhands/sdk/workspace/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
"""
return self

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
def __exit__(self, exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(_exc_tb)

Parameter was added as required

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(_exc_val)

Parameter was added as required

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(exc_tb)

Parameter was removed

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(exc_val)

Parameter was removed

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(_exc_tb)

Parameter was added as required

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(_exc_val)

Parameter was added as required

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(exc_tb)

Parameter was removed

Check warning on line 56 in openhands-sdk/openhands/sdk/workspace/base.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

BaseWorkspace.__exit__(exc_val)

Parameter was removed
"""Exit the workspace context and cleanup resources.

Default implementation performs no cleanup. Subclasses should override
to add cleanup logic (e.g., stopping containers, closing connections).

Args:
exc_type: Exception type if an exception occurred
exc_val: Exception value if an exception occurred
exc_tb: Exception traceback if an exception occurred
_exc_val: Exception value if an exception occurred (unused)
_exc_tb: Exception traceback if an exception occurred (unused)
"""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def __enter__(self) -> "ApptainerWorkspace":
"""Context manager entry - returns the workspace itself."""
return self

def __exit__(self, exc_type, exc_val, exc_tb) -> None: # type: ignore[no-untyped-def]
def __exit__(self, exc_type, _exc_val, _exc_tb) -> None: # type: ignore[no-untyped-def]
"""Context manager exit - cleans up the Apptainer container."""
self.cleanup()

Expand Down
2 changes: 1 addition & 1 deletion openhands-workspace/openhands/workspace/cloud/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,5 @@ def __del__(self) -> None:
def __enter__(self) -> "OpenHandsCloudWorkspace":
return self

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
def __exit__(self, exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:
self.cleanup()
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def __enter__(self) -> "DockerWorkspace":
"""Context manager entry - returns the workspace itself."""
return self

def __exit__(self, exc_type, exc_val, exc_tb) -> None: # type: ignore[no-untyped-def]
def __exit__(self, exc_type, _exc_val, _exc_tb) -> None: # type: ignore[no-untyped-def]
"""Context manager exit - cleans up the Docker container."""
self.cleanup()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,5 @@
def __enter__(self) -> "APIRemoteWorkspace":
return self

def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
def __exit__(self, exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:

Check warning on line 415 in openhands-workspace/openhands/workspace/remote_api/workspace.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

APIRemoteWorkspace.__exit__(exc_tb)

Parameter was removed

Check warning on line 415 in openhands-workspace/openhands/workspace/remote_api/workspace.py

View workflow job for this annotation

GitHub Actions / SDK programmatic API (Griffe)

APIRemoteWorkspace.__exit__(exc_val)

Parameter was removed
self.cleanup()
Loading