Repository navigation
[typescript/openai-agents] add inputProperty to nexusOperationAsTool for Operations with a scalar input - #217
Draft
campoy wants to merge 1 commit into
Conversation
This was referenced Oct 27, 2026
…r input nexusOperationAsTool sends the model's arguments to the Operation as one object. An Operation whose input is a string, such as nexus.operation<string, string>(), got that object as its input and returned a wrong value with no error. The new optional inputProperty field of the tool definition names one property of the arguments. When it is set, the Operation gets that property's value instead of the whole object. A name that is not in parameters fails the Workflow with an AgentsWorkflowError. Without the field, the Operation gets the same input as before.
campoy
force-pushed
the
fix/openai-agents-typescript-nexus-tool-string-input-misbound
branch
from
November 2, 2026 16:12
df104a7 to
81628f4
Compare
This branch has not been deployed
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.
What was changed
nexusOperationAsToolgets an optionalinputPropertyfield on its tool definition. It names one property ofparameters. When it is set, the Operation gets that property's value as its input instead of the whole arguments object:parameters.propertiesfails the Workflow with a non-retryableAgentsWorkflowError, asconvertAgentdoes for other tool mistakes.API change: additive. The new field is optional and existing tools behave the same.
Old runs and rollback: a tool call schedules the same Nexus Operation as before; only its input changes when the field is set, and Temporal does not compare inputs on replay. No
patchedgate is needed, and the previous release is a safe rollback (see testing).Why?
See #212. An Operation whose input is a string,
nexus.operation<string, string>(), got{"ref":"BK-7"}as its input, returnedconfirmed [object Object], and the run completed with no error. An Operation definition carries no input type at run time, so the plugin needs to be told which value to send.Checklist
Closes [Bug] openai-agents (TypeScript): nexusOperationAsTool gives a string-input Operation the arguments object #212
How was this tested:
nexusOperationAsTool inputProperty gives a scalar-input Operation one property of the argumentsinsrc/__tests__/test-openai-agents.ts, with its Workflow inworkflows/openai-agents.ts: a real Worker, a Nexus endpoint for a handler on the same Worker, and a fake model that callsconfirmwith{"ref":"BK-7"}. Withnexus-tools.tsfrommainit fails ont.deepEqual(received, ['BK-7'])(the handler got{ ref: 'BK-7' }). With this change it passes.inputProperty not in parameters throws AgentsWorkflowErrorinsrc/__tests__/nexus-tools.test.ts. It fails withnexus-tools.tsfrommainand passes with this change.make lintpasses (the 8 warningsmainhas, none in files this PR touches),make testpasses (209 tests;mainhas 207),make buildpacks, andcheck_npm_package.py,_shared/smoke.mjsandscripts/ci/check_conventions.pypass. Prettier with the SDK's settings is clean on the changed files.main(c664a34) it exits 1 with and without--input-property; with this change,--input-propertyexits 0 (confirm got: "BK-7",run result: "confirmed BK-7") and the run without it is unchanged.mainand on this branch, with and without the field. All 9 histories replay on both builds.main's open run completed on this branch, and this branch's open runs completed onmainwith the Operation output they recorded. The SDK does not compare a Nexus Operation's name on replay (a history withconfirmrenamed replays cleanly), so the control renames the first model Activity instead; it fails with[TMPRL1100]on both builds.CI covers the other Node versions and platforms.
Any docs updates needed?
The README paragraph, included here.
Related: #211 reports the same problem for
activityAsTool; its PR adds the same field with the same name and check. That PR and #213's PR add tests next to the ones here, so whichever merges second needs a small rebase. The PRs don't depend on each other.Open question:
toInput: ({ ref }) => ref, would allow any input shape but runs a callback in Workflow code. This PR keeps the smaller field, with the same name as theactivityAsToolPR.Draft while this question is open.