Skip to content

feat(server): serve the AgentCore relay envelope - #22

Merged
yash-kark merged 1 commit into
feat/p1-sdk-2-remove-events-sinkfrom
feat/p1-sdk-12-agentcore-relay
Oct 28, 2026
Merged

yash-kark merged 1 commit into
feat/p1-sdk-2-remove-events-sinkfrom
feat/p1-sdk-12-agentcore-relay

Conversation

@yash-kark

Copy link
Copy Markdown
Contributor

Stack: 12 of 12 (base #21). Plan: .claude/plans/p1-sdk-egress-routes.md phase 12 (C4; D24).

What changes

  • New computeragent.server.relay, mounted on the same app, as a port of CAS's runtime-agentcore/src/invocations.ts and relay.ts:
    • GET /ping → {status: Healthy | HealthyBusy, time_of_last_update}; busy while any turn runs.
    • POST /invocations takes relay envelope v1 and dispatches it in-process to the app's own routes (an ASGI call, answer read as it's produced).
    • A successful server-sent-event answer streams as text/event-stream, with the first frame : ca-relay {"instance","status"}.
    • Anything else answers HTTP 200 {relay: 1, instance, status, headers, body | bodyBase64}, skipping the same headers the reference skips.
    • A malformed envelope (including invalid base64, or a path to /invocations or /ping) answers status: 400 AGENTCORE_RELAY_REQUEST_INVALID.
    • instance is minted on the first invocation, not at process start, as in the reference (snapshot-restored microVMs).
  • One image now serves both runtimes; build it linux/arm64 for AgentCore.
  • Docs: guide §14 "On AgentCore"; CHANGELOG Added.

Tests

  • ruff clean; mypy at 18 (baseline); pytest -m "not integration": 662 passed.
  • New tests/test_server_relay.py (cases mirror relay.test.ts): ping idle/busy/idle, JSON round trip with an inner 404, an SSE head frame plus exactly the direct route's frames, binary bodies both ways, 8 malformed envelopes, and a stable per-app instance.
  • End to end (cas-e2e-dummy, IMAGE_APP=sdk ./run_cas_e2e.sh): real CAS → fake AWS → python -m computeragent.server → the real egress proxy → the fake gateway. 12/12 checks pass on Lambda MicroVM and AgentCore, with real usage on both.

🤖 Generated with Claude Code

@vrajp-lyzr
vrajp-lyzr added this pull request to stack #24 October 27, 2026 12:33
@yash-kark yash-kark mentioned this pull request Oct 28, 2026
@yash-kark
yash-kark force-pushed the feat/p1-sdk-12-agentcore-relay branch 8 times, most recently from 2e1cd15 to 0032b1d Compare October 28, 2026 17:20
Base automatically changed from feat/p1-sdk-11-app-server to feat/p1-sdk-2-remove-events-sink October 28, 2026 17:20
The app server also answers AgentCore: GET /ping (Healthy / HealthyBusy while
a turn runs) and POST /invocations, relay envelope v1 dispatched in-process to
its own routes. Streamed answers start with the `: ca-relay` head frame; other
answers return as {relay, instance, status, headers, body | bodyBase64}; a
malformed envelope is status 400 AGENTCORE_RELAY_REQUEST_INVALID. The
instance id is minted on the first invocation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yash-kark
yash-kark force-pushed the feat/p1-sdk-12-agentcore-relay branch from 0032b1d to 236871d Compare October 28, 2026 17:20
@yash-kark
yash-kark merged commit 1da8eca into feat/p1-sdk-2-remove-events-sink Oct 28, 2026
1 of 5 checks 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.

1 participant