feat: add agentworks invocation support - #249
Merged
Merged
Conversation
|
rhinchey-cs
force-pushed
the
agent-streaming-support
branch
from
June 26, 2026 18:25
8125a68 to
169970d
Compare
rhinchey-cs
force-pushed
the
agent-streaming-support
branch
from
June 26, 2026 20:26
3c3aaec to
ba17103
Compare
mraible
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
agentWorksAPI to Foundry-JS for invoking AgentWorks agents and consuming their responses as a stream. Unlike the existing request/response bridge calls that resolve to a single payload, agent invocations stream many chunks over a single message correlation ID, terminated by acompleteorerror.What's included
AgentWorks/AgentStreamabstraction (src/abstraction/agent-works.ts) —api.agentWorks.invoke(agentId, params)returns an
AgentStreamthat emits:data— each chunk as it arrivesend— stream completed successfullyerror— stream terminated with an errorStreams support
on()/off()subscription andabort()to cancel an in-flight invocation. The parentAgentWorksinstance tracks open streams and tears them all down on
destroy().Streaming bridge primitives (
src/bridge.ts) — addsopenStream()andsendStreamMessage(). UnlikepostMessage(), a stream subscription is not removed after the first response; it persists for the lifetime of the stream and is removed via the returnedclose()once the stream completes, errors, or is aborted. No timeout is applied since streams can run for arbitrary durations. Theabortrequest reuses the originalinvokemessage ID to correlate the cancellation.Message types (
src/types.ts) — adds theagentWorksmessage type,AgentWorksInvokeParams,AgentWorksRequestMessage(invoke/abort), andAgentWorksResponseMessage(chunk/complete/error), wired intothe
RequestMessage/ResponseMessageunions andResponseFormapping.Public exports (
src/index.ts) — exportsAgentWorksandAgentStream.Docs & tests — new README section under "Working with AgentWorks" and unit tests in
tests/abstraction/agent-works.test.ts.Usage