feat(harnesses): Pass run context to agent factories#55
Merged
Conversation
Let first-party harness agent factories receive the eval input and harness context before instrumentation or execution. This keeps input-dependent agents on the native replay path without side-channel setup. Fixes GH-54 Co-Authored-By: OpenAI Codex <codex@openai.com>
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.
Agent factories in the first-party harnesses now receive the eval input and harness context before the harness instruments tools or executes the run. This lets per-run agents derive instructions, tool closures, metadata, and artifacts without AsyncLocalStorage or other side-channel setup.
Contextual Factories
OpenAI Agents and Pi AI create their agents before native tool instrumentation, so createAgent now receives { input, context } in both harnesses. AI SDK agent factories receive the same shape for consistency and lower boilerplate.
Docs And Policy
Update harness READMEs, skill references, and the API design policy so future harness surfaces prefer one contextual per-run factory object.
Validated with pnpm exec biome lint, pnpm exec vitest run for the three harness test files, pnpm run typecheck, and pnpm run build.
Fixes #54