npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wavespec/adapter-openai-agents

v1.2.0

Published

OpenAI Agents SDK adapter for WaveKit

Readme

OpenAI Agents SDK Adapter

A comprehensive Agent Harness adapter for testing multi-agent workflows using the OpenAI Agents SDK.

Features

  • Multi-agent workflows - Create and test complex agent interactions
  • Tool execution - Mock, template, and real tool implementations
  • Agent handoffs - Test delegation between agents
  • Guardrails - Input/output validation and content filtering
  • Lifecycle events - Track agent execution and tool calls
  • Structured outputs - Enforce JSON schema with Zod validation
  • MCP server support - Integrate Model Context Protocol servers
  • Streaming - Real-time response streaming

Installation

npm install @wavespec/adapter-openai-agents @openai/agents openai

Configuration

Set your OpenAI API key:

export OPENAI_API_KEY=your-api-key

Create a test suite YAML file:

suite:
  name: "My Agent Test"
  adapter: "openai-agents"

tests:
  - name: "Create a helpful assistant"
    operation: create_agent
    params:
      name: "Assistant"
      instructions: "You are a helpful assistant"
      model: "gpt-4.1"
    assertions:
      - type: success

Supported Operations

create_agent

Create an agent with instructions, tools, and settings:

- operation: create_agent
  params:
    name: "WeatherBot"
    instructions: "You provide weather information"
    model: "gpt-4.1"
    tools:
      - name: "get_weather"
        description: "Get weather for a location"
        parameters:
          location: { type: "string", description: "City name" }
        mode: "mock"  # or "template" or "module"

run_agent

Execute an agent with a message:

- operation: run_agent
  params:
    agent: "{{agent_id}}"
    message: "What's the weather in San Francisco?"
    stream: false

create_tool

Create a reusable tool:

- operation: create_tool
  params:
    name: "calculate"
    description: "Perform calculations"
    parameters:
      expression: { type: "string" }
    mode: "template"
    template: "Result: {{args.expression}}"

Tool Execution Modes

  • mock - Returns success without execution (for testing)
  • template - Safe string interpolation with {{args.field}} syntax
  • module - Load and execute external JavaScript/TypeScript functions

Model Settings

Configure model behavior:

- operation: create_agent
  params:
    name: "Agent"
    instructions: "..."
    model: "gpt-4.1"
    modelSettings:
      temperature: 0.7      # 0-2, lower = more deterministic
      topP: 0.9            # 0-1, nucleus sampling
      maxTokens: 1000      # Maximum response length
      frequencyPenalty: 0  # -2 to 2, reduce repetition
      presencePenalty: 0   # -2 to 2, encourage diversity

Agent Handoffs

Delegate between agents:

- operation: create_agent
  params:
    name: "Receptionist"
    instructions: "Triage user requests"
    handoffSettings:
      handoffTo:
        - agent: "{{specialist_id}}"
          description: "Technical questions"

Guardrails

Add input/output validation:

- operation: create_agent
  params:
    name: "Agent"
    instructions: "..."
    guardrails:
      input:
        - type: "content_filter"
          policy: "block_harmful"
      output:
        - type: "format_validator"
          schema: { type: "object" }

Lifecycle Events

Track execution events:

- operation: run_agent
  params:
    agent: "{{agent_id}}"
    message: "Hello"
    captureLifecycleEvents: true

Events include:

  • Agent creation
  • Tool invocations
  • Handoffs
  • Errors

Built-in Tools

Use OpenAI's built-in tools:

- operation: create_agent
  params:
    name: "ResearchBot"
    instructions: "Research topics"
    builtinTools:
      - type: "web_search"
      - type: "file_search"

Available built-in tools:

  • web_search - Search the web
  • file_search - Search uploaded files
  • code_interpreter - Execute Python code
  • image_generation - Generate images

Structured Outputs

Enforce response format with Zod schemas:

- operation: create_agent
  params:
    name: "DataExtractor"
    instructions: "Extract structured data"
    outputType:
      schema:
        type: "object"
        properties:
          name: { type: "string" }
          age: { type: "number" }
        required: ["name", "age"]

Example: Multi-Agent Workflow

suite:
  name: "Customer Service Workflow"
  adapter: "openai-agents"

tests:
  - name: "Create receptionist agent"
    operation: create_agent
    params:
      name: "Receptionist"
      instructions: "Triage customer requests"
      model: "gpt-4.1"
    store:
      receptionist_id: "response.raw.agentId"

  - name: "Create specialist agent"
    operation: create_agent
    params:
      name: "TechSupport"
      instructions: "Resolve technical issues"
      model: "gpt-4.1"
    store:
      specialist_id: "response.raw.agentId"

  - name: "Configure handoff"
    operation: create_agent
    params:
      name: "Receptionist"
      instructions: "Triage and delegate"
      handoffSettings:
        handoffTo:
          - agent: "{{specialist_id}}"
            description: "Technical issues"
    store:
      receptionist_id: "response.raw.agentId"

  - name: "Test workflow"
    operation: run_agent
    params:
      agent: "{{receptionist_id}}"
      message: "My wifi isn't working"
    assertions:
      - type: success
      - type: field_exists
        field: "response.lifecycle.handoffs"

Templates

The adapter includes 19 example templates covering:

  • Basic agent creation
  • Tool execution (mock, template, module modes)
  • Agent handoffs and delegation
  • Lifecycle event tracking
  • Guardrails and validation
  • Model settings and configuration
  • Structured outputs
  • Built-in tools
  • Full multi-agent workflows

Run templates with:

harness run templates/basic.yaml
harness run templates/with-handoffs.yaml
harness run templates/full-workflow.yaml

Development

Build the adapter:

npm run build

Run tests:

npm test

Type check:

npm run type-check

Requirements

  • Node.js 18+
  • OpenAI API key
  • @openai/agents ^0.2.1
  • openai ^4.0.0

License

MIT

Documentation

For complete documentation, see the Agent Harness documentation.

For OpenAI Agents SDK documentation, see @openai/agents.