Skip to content

Commit 83c323a

Browse files
committed
chore: release version 0.7.0
- Add session pause/resume functionality - Enhance browser automation test stability - Improve HTTP client and API models - Update documentation and example code - Add MCP access guide - Enhance unit and integration test coverage
1 parent dc1f343 commit 83c323a

42 files changed

Lines changed: 3897 additions & 673 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGES.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,48 @@
11
# Changelog
22

3+
## [0.7.0] - 2025-12-18
4+
5+
### New Features
6+
- **Browser Fingerprint Enhancement**: Comprehensive browser fingerprint management with persistence, local sync, and advanced configuration options
7+
- **Computer Automation Module**: Full desktop automation capabilities including:
8+
- Screenshot capture support for AGB sessions
9+
- Keyboard input functionality with comprehensive key support
10+
- Mouse operations with button and scroll direction enums
11+
- Window listing and management functionality
12+
- Application operations support
13+
- **File Transfer Function**: Complete file transfer functionality for moving files between local and remote environments
14+
- **Session Pause and Resume**: Added pause and resume functionality for sessions to optimize resource usage and costs
15+
- **Async Session Deletion**: Migrated session deletion API from `release_mcp_session` to `delete_session_async` with polling support
16+
- **Browser Type Configuration**: Support for browser type and command arguments settings for enhanced browser control
17+
- **MCP Access Documentation**: Comprehensive guide for MCP (Model Context Protocol) access and configuration
18+
19+
### Enhancements
20+
- **Context Manager**: Improved error handling by returning error results instead of raising exceptions in context sync validation
21+
- **Browser Agent**: Enhanced browser agent with improved integration tests and better error handling
22+
- **API Documentation**: Added fingerprint module to API documentation generation
23+
- **Code Examples**: Optimized and improved code examples throughout documentation
24+
25+
### Documentation
26+
- Added MCP access guide with comprehensive configuration instructions
27+
- Added examples for application and window operations
28+
- Updated text input examples in documentation
29+
- Corrected documentation regarding command execution instructions
30+
- Standardized guides structure to match template
31+
- Fixed ContextManager docstring to use AGB instead of AgentBay
32+
- Removed example code from ContextManager docstring
33+
- Added file transfer guide markdown
34+
35+
### Refactoring
36+
- Removed unused `http_port` and `token` fields from session response models
37+
- Improved context sync validation to return error results instead of exceptions
38+
- Cleaned up unrelated files and code
39+
40+
### Testing & CI/CD
41+
- Added comprehensive unit and integration tests for pause and resume functionality
42+
- Optimized CI/CD pipeline summary with switch state for better visibility
43+
- Enhanced test coverage for computer module, file transfer, and browser fingerprint features
44+
- Fixed context manager sync tests to match new validation logic
45+
346
## [0.6.0] - 2025-12-04
447

548
### New Features
@@ -27,7 +70,6 @@
2770
- Added CI bot guard to prevent infinite loops and enhanced error detection
2871
- Fixed AONE documentation pipeline configuration and optimized documentation workflow
2972

30-
3173
## [0.5.0] - 2025-11-20
3274

3375
### New Features

agb/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .context_sync import ContextSync, SyncPolicy, UploadPolicy, DownloadPolicy, DeletePolicy, ExtractPolicy, UploadStrategy, DownloadStrategy, UploadMode, MappingPolicy
99
from .extension import ExtensionsService, ExtensionOption, Extension
1010
from .modules.computer import Computer, MouseButton, ScrollDirection
11+
from .model.response import SessionPauseResult, SessionResumeResult
1112

1213
__all__ = [
1314
"AGB", "Session", "CreateSessionParams", "HTTPClient", "Client",
@@ -17,5 +18,7 @@
1718
"ContextSync", "SyncPolicy", "UploadPolicy", "DownloadPolicy", "DeletePolicy", "ExtractPolicy",
1819
"UploadStrategy", "DownloadStrategy", "UploadMode", "MappingPolicy", "ExtensionsService","ExtensionOption","Extension",
1920
# Computer related exports
20-
"Computer", "MouseButton", "ScrollDirection"
21+
"Computer", "MouseButton", "ScrollDirection",
22+
# Pause and resume related exports
23+
"SessionPauseResult", "SessionResumeResult",
2124
]

agb/agb.py

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
)
2020
from agb.config import Config, load_config, BROWSER_DATA_PATH
2121
from agb.context_sync import ContextSync, WhiteList, UploadPolicy, BWList, RecyclePolicy, SyncPolicy
22-
from agb.model.response import DeleteResult, SessionResult, GetSessionResult, GetSessionData, SessionListResult
22+
from agb.model.response import DeleteResult, SessionResult, GetSessionResult, GetSessionData, SessionListResult, SessionPauseResult, SessionResumeResult
2323
from agb.session import Session
2424
from agb.session_params import CreateSessionParams
2525
from agb.context import ContextService
@@ -171,10 +171,10 @@ def create(self, params: Optional[CreateSessionParams] = None) -> SessionResult:
171171
response: CreateSessionResponse = self.client.create_mcp_session(request)
172172

173173
try:
174-
logger.debug("Response body:")
175-
logger.debug(response.to_dict())
174+
logger.info("Response body:")
175+
logger.info(response.to_dict())
176176
except Exception:
177-
logger.debug(f"Response: {response}")
177+
logger.info(f"Response: {response}")
178178

179179
# Extract request ID
180180
request_id_attr = getattr(response, "request_id", "")
@@ -509,6 +509,7 @@ def get_session(self, session_id: str) -> GetSessionResult:
509509
session_id=response.data.session_id or session_id,
510510
success=True,
511511
resource_url=response.data.resource_url or "",
512+
status=response.data.status or "",
512513
)
513514

514515
# Log API response with key details
@@ -587,4 +588,68 @@ def get(self, session_id: str) -> SessionResult:
587588
request_id=get_result.request_id or "",
588589
success=True,
589590
session=session,
590-
)
591+
)
592+
593+
def pause(self, session: Session, timeout: int = 600, poll_interval: float = 2.0) -> SessionPauseResult:
594+
"""
595+
Pause a session, putting it into a dormant state.
596+
597+
Args:
598+
session (Session): The session to pause.
599+
timeout (int, optional): Timeout in seconds to wait for the session to pause.
600+
Defaults to 600 seconds.
601+
poll_interval (float, optional): Interval in seconds between status polls.
602+
Defaults to 2.0 seconds.
603+
604+
Returns:
605+
SessionPauseResult: Result containing the request ID, success status, and final session status.
606+
"""
607+
return session.pause(timeout, poll_interval)
608+
609+
async def pause_async(self, session: Session, timeout: int = 600, poll_interval: float = 2.0) -> SessionPauseResult:
610+
"""
611+
Pause a session asynchronously.
612+
613+
Args:
614+
session (Session): The session to pause.
615+
timeout (int, optional): Timeout in seconds to wait for the session to pause.
616+
Defaults to 600 seconds.
617+
poll_interval (float, optional): Interval in seconds between status polls.
618+
Defaults to 2.0 seconds.
619+
620+
Returns:
621+
SessionPauseResult: Result containing the request ID, success status, and final session status.
622+
"""
623+
return await session.pause_async(timeout, poll_interval)
624+
625+
def resume(self, session: Session, timeout: int = 600, poll_interval: float = 2.0) -> SessionResumeResult:
626+
"""
627+
Resume a session from a paused state.
628+
629+
Args:
630+
session (Session): The session to resume.
631+
timeout (int, optional): Timeout in seconds to wait for the session to resume.
632+
Defaults to 600 seconds.
633+
poll_interval (float, optional): Interval in seconds between status polls.
634+
Defaults to 2.0 seconds.
635+
636+
Returns:
637+
SessionResumeResult: Result containing the request ID, success status, and final session status.
638+
"""
639+
return session.resume(timeout, poll_interval)
640+
641+
async def resume_async(self, session: Session, timeout: int = 600, poll_interval: float = 2.0) -> SessionResumeResult:
642+
"""
643+
Resume a session asynchronously.
644+
645+
Args:
646+
session (Session): The session to resume.
647+
timeout (int, optional): Timeout in seconds to wait for the session to resume.
648+
Defaults to 600 seconds.
649+
poll_interval (float, optional): Interval in seconds between status polls.
650+
Defaults to 2.0 seconds.
651+
652+
Returns:
653+
SessionResumeResult: Result containing the request ID, success status, and final session status.
654+
"""
655+
return await session.resume_async(timeout, poll_interval)

agb/api/client.py

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import aiohttp
99

10-
from agb.api.models import (
10+
from .models import (
1111
CallMcpToolRequest,
1212
CallMcpToolResponse,
1313
CreateSessionRequest,
@@ -30,6 +30,14 @@
3030
SetLabelResponse,
3131
GetLabelRequest,
3232
GetLabelResponse,
33+
# Pause and Resume imports
34+
PauseSessionRequest,
35+
PauseSessionResponse,
36+
ResumeSessionRequest,
37+
ResumeSessionResponse,
38+
# Delete session async imports
39+
DeleteSessionAsyncRequest,
40+
DeleteSessionAsyncResponse,
3341
# Context related imports
3442
ListContextsRequest,
3543
ListContextsResponse,
@@ -580,3 +588,105 @@ def get_and_load_internal_context(self, request: GetAndLoadInternalContextReques
580588
finally:
581589
# Always close the HTTP client to release resources
582590
http_client.close()
591+
592+
def pause_session(self, request: PauseSessionRequest) -> PauseSessionResponse:
593+
"""
594+
Pause session using HTTP client
595+
"""
596+
if not request.authorization:
597+
raise ValueError("authorization is required")
598+
599+
if not request.session_id:
600+
raise ValueError("session_id is required")
601+
602+
# Get HTTP client and make request directly with the input request
603+
http_client = self._get_http_client(request.authorization)
604+
605+
try:
606+
response = http_client.pause_session(request)
607+
return response
608+
finally:
609+
# Always close the HTTP client to release resources
610+
http_client.close()
611+
612+
async def pause_session_async(self, request: PauseSessionRequest) -> PauseSessionResponse:
613+
"""
614+
Pause session asynchronously using HTTP client
615+
"""
616+
if not request.authorization:
617+
raise ValueError("authorization is required")
618+
619+
if not request.session_id:
620+
raise ValueError("session_id is required")
621+
622+
# Get HTTP client and make request directly with the input request
623+
http_client = self._get_http_client(request.authorization)
624+
625+
try:
626+
response = await http_client.pause_session_async(request)
627+
return response
628+
finally:
629+
# Always close the HTTP client to release resources
630+
http_client.close()
631+
632+
633+
def resume_session(self, request: ResumeSessionRequest) -> ResumeSessionResponse:
634+
"""
635+
Resume session using HTTP client
636+
"""
637+
if not request.authorization:
638+
raise ValueError("authorization is required")
639+
640+
if not request.session_id:
641+
raise ValueError("session_id is required")
642+
643+
# Get HTTP client and make request directly with the input request
644+
http_client = self._get_http_client(request.authorization)
645+
646+
try:
647+
response = http_client.resume_session(request)
648+
return response
649+
finally:
650+
# Always close the HTTP client to release resources
651+
http_client.close()
652+
653+
async def resume_session_async(self, request: ResumeSessionRequest) -> ResumeSessionResponse:
654+
"""
655+
Resume session asynchronously using HTTP client
656+
"""
657+
if not request.authorization:
658+
raise ValueError("authorization is required")
659+
660+
if not request.session_id:
661+
raise ValueError("session_id is required")
662+
663+
# Get HTTP client and make request directly with the input request
664+
http_client = self._get_http_client(request.authorization)
665+
666+
try:
667+
response = await http_client.resume_session_async(request)
668+
return response
669+
finally:
670+
# Always close the HTTP client to release resources
671+
http_client.close()
672+
673+
def delete_session_async(self, request: "DeleteSessionAsyncRequest") -> "DeleteSessionAsyncResponse":
674+
"""
675+
Delete session asynchronously using HTTP client
676+
"""
677+
if not request.authorization:
678+
raise ValueError("authorization is required")
679+
680+
if not request.session_id:
681+
raise ValueError("session_id is required")
682+
683+
# Get HTTP client and make request directly with the input request
684+
http_client = self._get_http_client(request.authorization)
685+
686+
try:
687+
response = http_client.delete_session_async(request)
688+
return response
689+
finally:
690+
# Always close the HTTP client to release resources
691+
http_client.close()
692+

0 commit comments

Comments
 (0)