feat: add OpenAI Runner protocol implementation (AIC-2388)#1337
Draft
jsonbailey wants to merge 1 commit intojb/aic-2388/js-runner-protocolfrom
Draft
feat: add OpenAI Runner protocol implementation (AIC-2388)#1337jsonbailey wants to merge 1 commit intojb/aic-2388/js-runner-protocolfrom
jsonbailey wants to merge 1 commit intojb/aic-2388/js-runner-protocolfrom
Conversation
Adds OpenAIModelRunner, OpenAIAgentRunner, and OpenAIRunnerFactory that implement the Runner protocol introduced in JS PR 6. The runners return RunnerResult instead of the legacy ChatResponse / StructuredResponse. OpenAIAgentRunner runs a tool-calling loop using the OpenAI Chat Completions API, populating LDAIMetrics.toolCalls with the names of tools the model invoked. Tool implementations are supplied via a ToolRegistry passed to OpenAIRunnerFactory.createAgent. The deprecated OpenAIProvider class is preserved so AIProviderFactory continues to work during the migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.
Summary
Adds Runner-protocol classes for the OpenAI provider, replacing the deprecated
AIProviderextension model introduced in earlier work. New classes:OpenAIModelRunner—Runnerfor chat completions;run(messages, outputType?)returnsRunnerResult { content, metrics, raw, parsed? }. Structured output is parsed automatically via OpenAI'sjson_schemaresponse format.OpenAIAgentRunner—Runnerfor a single agent. Runs a tool-calling loop using the OpenAI Chat Completions API. Tool definitions come fromconfig.model.parameters.tools; tool callables come from a caller-suppliedToolRegistry. PopulatesLDAIMetrics.toolCallswith the names of tools the model invoked.OpenAIRunnerFactory— exposescreateModel(config)andcreateAgent(config, tools?). Shares oneOpenAIclient across all runners produced by the factory.convertMessagesToOpenAI,getAIMetricsFromResponse,getAIUsageFromResponse— helper functions usable from a tracker'strackMetricsOf.The legacy
OpenAIProviderclass is preserved soAIProviderFactory(also@deprecated) keeps working until the managed layer fully migrates toRunner.run().Stacked on
jb/aic-2388/js-runner-protocol(JS PR 6).Test plan
yarn workspace @launchdarkly/server-sdk-ai-openai test— 33 tests pass (existing 13 + 20 new for the Runner classes / helpers)yarn workspace @launchdarkly/server-sdk-ai-openai lint— cleanyarn workspace @launchdarkly/server-sdk-ai-openai run build— clean🤖 Generated with Claude Code