Skip to content

[WASM] Integration tests: Hooks system #2379

@awsarron

Description

@awsarron

Parent issue

strands-agents/sdk-typescript#1104

Scope

Write integration tests validating the hooks/callback system:

  • HookRegistry on Agent
  • Registering callbacks for specific stream event types
  • Callbacks fire at correct lifecycle points (before/after invocation, model call, tool call)
  • Multiple callbacks for the same event
  • Callback receives correct event data
  • Stream event type coverage (text-delta, tool-use, tool-result, stop, error, etc.)

Context

The Python hooks system subscribes to stream events emitted by the WASM guest. Each event arm in the WIT stream-event variant maps to a Python class. Callbacks are registered per-class on the HookRegistry.

Key areas:

  • Event dispatch correctly maps WIT variant arms to Python callback classes
  • Callback ordering (registration order for "before" events, reverse for "after")
  • Event data is correctly deserialized from WIT types

Done when

  • Callbacks fire for lifecycle events (invocation, model call, tool call)
  • Text-delta and other stream events are receivable via callbacks
  • Multiple callbacks per event type work
  • Event data contains expected fields
  • Callbacks can observe full agent lifecycle end-to-end

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-hooksFeatures or requests that might be implementable via hooksenhancementNew feature or requestpythonPull requests that update python code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions