Skip to content

feat(agentcore): enhance Browser & Code Interpreter toolkits with full session config, new tools, and telemetry#4882

Open
kevin-orellana wants to merge 2 commits intocrewAIInc:mainfrom
kevin-orellana:feat/agentcore-tools-enhancements
Open

feat(agentcore): enhance Browser & Code Interpreter toolkits with full session config, new tools, and telemetry#4882
kevin-orellana wants to merge 2 commits intocrewAIInc:mainfrom
kevin-orellana:feat/agentcore-tools-enhancements

Conversation

@kevin-orellana
Copy link

@kevin-orellana kevin-orellana commented Mar 14, 2026

Summary

Enhances the AWS Bedrock AgentCore Browser and Code Interpreter toolkits to expose the full SDK feature surface — session configuration with typed dataclass support, new tool capabilities, and telemetry tracking.

Telemetry

  • Add integration_source="crewai" to BrowserClient and CodeInterpreter constructors for customer acquisition tracking via User-Agent header

Session Configuration Passthrough (with SDK Typed Dataclass Support)

Expose all start() parameters so users can configure sessions at toolkit creation time. Previously only identifier was supported — all other SDK options were silently ignored.

All config parameters accept both SDK typed dataclasses and plain dicts, matching the SDK's own BrowserClient.start() signature. Typed dataclasses give users IDE autocomplete, validation at construction time, and convenience factory methods.

Browser — 5 new params on BrowserToolkit / create_browser_toolkit():

  • session_timeout_seconds — session timeout in seconds (1–28800, default 3600)
  • viewportViewportConfiguration or dict. Factory methods: .desktop_hd(), .laptop(), .mobile(), etc.
  • proxy_configurationProxyConfiguration or dict. Proxy routing with optional auth via Secrets Manager
  • extensionslist[BrowserExtension | dict]. S3-hosted browser extensions
  • profile_configurationProfileConfiguration or dict. Persist cookies/local storage across sessions

Code Interpreter — 1 new param on CodeInterpreterToolkit / create_code_interpreter_toolkit():

  • session_timeout_seconds — session timeout in seconds (default 900)

All params default to None (SDK defaults apply). No validation on our side — the SDK handles it.

Custom Sandbox Identifier

  • Add optional identifier parameter to BrowserToolkit, CodeInterpreterToolkit, and BrowserSessionManager for custom browser/interpreter resources (VPC, recording, Web Bot Auth)
  • Passed through to .start(identifier=...) on the underlying SDK clients

New Browser Tools (3)

  • GenerateLiveViewUrlTool — generate a presigned URL for live browser viewing
  • TakeControlTool — take manual control of the browser (disables automation)
  • ReleaseControlTool — release manual control (re-enables automation, reconnects Playwright)

New Code Interpreter Tools (6)

  • UploadFileTool / UploadFilesTool — upload files with optional semantic descriptions
  • DownloadFileTool / DownloadFilesTool — download files from the sandbox
  • InstallPackagesTool — install pip packages with optional --upgrade flag
  • ClearContextTool — reset the Python execution context

Browser Session Manager

  • Add reconnect_sync_browser() / reconnect_async_browser() for CDP reconnection after release_control()
  • Add get_browser_client() / get_async_browser_client() accessors for the underlying BrowserClient
  • Thread-safe session creation with per-key events to serialize without blocking unrelated callers

Usage Examples

# Browser with typed SDK dataclasses (recommended)
from bedrock_agentcore.tools import (
    ViewportConfiguration, ProxyConfiguration, ExternalProxy,
    ProfileConfiguration,
)

toolkit, tools = create_browser_toolkit(
    region="us-west-2",
    viewport=ViewportConfiguration.desktop_hd(),  # 1920x1080
    proxy_configuration=ProxyConfiguration(
        proxies=[ExternalProxy(server="proxy.corp.com", port=8080)],
        bypass_patterns=[".amazonaws.com"],
    ),
    profile_configuration=ProfileConfiguration(profile_identifier="my-profile"),
    session_timeout_seconds=7200,
)

# Browser with plain dicts (also works)
toolkit, tools = create_browser_toolkit(
    region="us-west-2",
    viewport={"width": 1920, "height": 1080},
    proxy_configuration={
        "proxies": [{"externalProxy": {"server": "proxy.corp.com", "port": 8080}}],
        "bypass": {"domainPatterns": [".amazonaws.com"]},
    },
    session_timeout_seconds=7200,
)

# Code interpreter with longer timeout
toolkit, tools = create_code_interpreter_toolkit(
    region="us-west-2",
    session_timeout_seconds=1800,
)

Test Plan

  • 68 unit tests (all pass) covering telemetry, identifier passthrough, session config passthrough with both dicts and typed dataclasses (sync + async), all new tools, edge cases
  • Live integration tests against real AgentCore sessions verifying:
    • Browser viewport 1920x1080 returned in session API response
    • Browser timeout 600s applied correctly
    • Code interpreter timeout 1800s applied correctly
    • Default timeouts (3600s browser, 900s CI) when no config specified

Note

Medium Risk
Modifies AgentCore Browser/Code Interpreter session lifecycle and configuration passthrough (including reconnection behavior), which could impact remote session stability and resource cleanup. Changes are covered by new unit tests but touch threaded/async session management and SDK start kwargs.

Overview
Adds new Amazon Bedrock AgentCore documentation pages (EN/KO) and navigation entries for AgentCore Browser, AgentCore Code Interpreter, and an AgentCore Overview.

Extends the AgentCore BrowserToolkit and CodeInterpreterToolkit to pass through additional SDK session configuration (e.g., session_timeout_seconds, viewport, proxy_configuration, extensions, profile_configuration, plus identifier), and tags SDK client creation with integration_source="crewai".

Introduces new browser tools for human oversight/control (including generate_live_view_url, take_control, release_control with Playwright reconnection) and new code-interpreter tools for file transfer, package install, and context reset. Adds comprehensive unit tests for the new capabilities and config passthrough.

Written by Cursor Bugbot for commit d4dd9dd. This will update automatically on new commits. Configure here.

@kevin-orellana kevin-orellana force-pushed the feat/agentcore-tools-enhancements branch 5 times, most recently from 13e2d95 to 746fb54 Compare March 15, 2026 04:08
@kevin-orellana kevin-orellana changed the title feat(agentcore): add telemetry, VPC identifier, and new Browser/CI tools feat(agentcore): enhance Browser & Code Interpreter toolkits with full session config, new tools, and telemetry Mar 15, 2026
@kevin-orellana kevin-orellana marked this pull request as ready for review March 15, 2026 04:26
@kevin-orellana kevin-orellana force-pushed the feat/agentcore-tools-enhancements branch 2 times, most recently from 5bfb5fa to e23da7d Compare March 15, 2026 05:14
@kevin-orellana
Copy link
Author

Fixed in e23da7d — changed if self.identifier: to if self.identifier is not None: in both browser_session_manager.py (sync + async paths) and code_interpreter_toolkit.py. Now consistent with all other params.

@kevin-orellana kevin-orellana force-pushed the feat/agentcore-tools-enhancements branch from 8313b9c to 7729b5c Compare March 16, 2026 01:28
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

…ols for Browser & Code Interpreter

- Add integration_source="crewai" telemetry to BrowserClient and CodeInterpreter
- Add identifier param for custom browser/code interpreter sandbox selection
- Browser: add GenerateLiveViewUrl, TakeControl, ReleaseControl tools
- Browser: fix CDP reconnect after release_control() invalidates connection
- Code Interpreter: add UploadFile, UploadFiles, InstallPackages, DownloadFile, DownloadFiles, ClearContext tools
- 59 unit tests (30 browser + 29 code interpreter)
@kevin-orellana kevin-orellana force-pushed the feat/agentcore-tools-enhancements branch 2 times, most recently from 98c7f16 to f4b7029 Compare March 16, 2026 02:42
…gbot findings

New .mdx doc pages for BrowserToolkit and CodeInterpreterToolkit with
navigation entries, overview cards, verified install instructions, and
end-to-end tested code examples.

Also addresses Cursor Bugbot findings in browser_session_manager.py:
- Extract duplicated start_kwargs construction into _build_start_kwargs()
- Prevent corrupt session state on reconnect failure by removing dead
  session entries before re-raising
@kevin-orellana kevin-orellana force-pushed the feat/agentcore-tools-enhancements branch from f4b7029 to d4dd9dd Compare March 16, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants