Skip to content

feat(e2b): support token acquisition via GET /sandboxes/{id}#1

Merged
wswcfan merged 2 commits intoTencentCloudAgentRuntime:mainfrom
vaaandark:main
Feb 11, 2026
Merged

feat(e2b): support token acquisition via GET /sandboxes/{id}#1
wswcfan merged 2 commits intoTencentCloudAgentRuntime:mainfrom
vaaandark:main

Conversation

@vaaandark
Copy link
Member

@vaaandark vaaandark commented Feb 11, 2026

Summary

Enable E2B backend to acquire access tokens from the GET /sandboxes/{id} endpoint, unifying token recovery behavior across both Cloud and E2B backends.

Related Issues

N/A

Changes

  • internal/client/e2b.go

    • Rewrite GetInstance to call GET /sandboxes/{id} directly (instead of iterating via ListInstances), parsing the envdAccessToken field from the response
    • Rewrite AcquireToken to retrieve token via GetInstance instead of returning an "unsupported" error
  • cmd/sandbox_helper.go

    • Remove E2B-specific error branch in GetCachedTokenOrAcquire, unifying the acquire flow for both backends
  • cmd/browser.go

    • Remove E2B-specific error handling in acquireInstanceToken
  • internal/client/interface.go

    • Update AcquireToken interface doc comment to reflect E2B support

Motivation

Previously, the E2B backend only returned the access token once during CreateInstance. If the local token cache (~/.ags/tokens.json) was lost, the instance became unusable and had to be recreated. The GET /sandboxes/{id} API actually includes the envdAccessToken field in its response, so tokens can be re-acquired at any time.

Testing

  • Verified GET /sandboxes/{id} returns envdAccessToken for running instances
  • go build ./... passes with no errors

@vaaandark vaaandark changed the title feat: support token acquisition for E2B backend via connect API feat(e2b): support token acquisition via GET /sandboxes/{id} Feb 11, 2026
@keithfx999
Copy link
Member

LGTM

Copy link
Member

@keithfx999 keithfx999 left a comment

Choose a reason for hiding this comment

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

LGTM

@wswcfan wswcfan merged commit d869146 into TencentCloudAgentRuntime:main Feb 11, 2026
1 check passed
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.

3 participants