-
Notifications
You must be signed in to change notification settings - Fork 376
feat: fix #272 add memory feature #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 269c2fb The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
const executeRun = async () => { | ||
if (resolvedOptions.stream) { | ||
const streamResult = await this.#runIndividualStream( | ||
agent, | ||
preparedInput, | ||
resolvedOptions, | ||
); | ||
// for streaming runs, the outputs will be save later on | ||
await saveStreamInputToSession(session, sessionOriginalInput); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Record streamed input before writing outputs to session
When a session is provided to Runner.run
for streaming runs, saveStreamResultToSession
is invoked inside the streaming loop before the method resolves, yet saveStreamInputToSession
is only executed afterwards. As a result, assistant outputs are added to the session before the corresponding user message, so the persisted conversation history appears in reverse order. Persist the user input before or along with the streamed outputs so the saved transcript matches the actual turn order.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex yeah, good catch; can you fix the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Persisted the user's input in the session before starting a streaming run so saved transcripts keep messages in the correct order.packages/agents-core/src/run.tsL1015-L1028
Testing
⚠️ pnpm -r build-check
(fails in @openai/agents-openai:tsc --noEmit -p ./tsconfig.test.json
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving assuming you are doing more testing on compatibility with resuming state in the case of human in the loop
Yeah, I'll take some time to further tests before merging this |
This PR is stale because it has been open for 10 days with no activity. |
This PR is stale because it has been open for 10 days with no activity. |
How's this going? Would be great to get sessions in there to get more parity with the Python SDK! Plus, I could really use it :) |
This pull request resolves #272
references: