OpenAI Agents SDK Testing
Overview
OpenAI Agents SDK is a framework that enables the development of agentic AI apps and systems with a light-weight package and very few abstractions. It can be used to create standalone agents or multi-agent systems. Once you have created your agent(s), you can wrap the agent(s) in FastAPI and host them on a public domain. You will need to create a bearer token for authentication with your server.
What API Credentials does OpenAI Agents SDK Use?
To access and test a OpenAI Agents SDK System, two main credentials are required.
-
API_URL
- Acts as the Base URL to access the agent(s)
- Used for GET and POST methods to run the agents and access the response of the last agent in the workflow.
-
Bearer Token
- Used for Authorization in accessing the agent(s)
Where do I find these Credentials?
As these credentials cannot be generated, you will have to create your own. One option is to:
-
Wrap your agents with FastAPI
- The path for both decorators should be “/inputs”. No path parameters needed.
- The POST function takes in a request object and uses Depends() to call a function for authentication. It returns the last agent’s response in the form of {“response”: your_string_response}.
- The request object should have one attribute only. It should be a string attribute named prompt. You can validate your object with the Pydantic BaseModel.
- Inside the POST function, your agent(s) are run and the response, properly formatted, is stored in a global dictionary.
- The GET function uses Depends() to call a function for authentication. It then accesses the global dictionary and returns the response.
-
Deploy your agents with ASGI web servers such as uvicorn.
-
Expose your local dev server for testing with tools like ngrok.
How do I start testing my agents with Asenion Web UI?
- Navigate to Asenion Web UI and log in with your credentials
- Select Configuration on the left tab
- Select Target Model in the top tab
- Scroll down to Add New Configuration and in the Target System Field dropdown, select OpenAI Agents SDK
- Input the API_URL, Bearer Token, and a Configuration Name
- Press the Add Configuration button
- Navigate to Testing on the left tab
- Choose your new OpenAI Agents SDK configuration from the Select Target System dropdown menu
- Input configurations such as storage configuration, probe categories, number of attempts per Probe, etc
- Press the Run Tests button
- You may now scroll down to view the results of the test or select Results in the left tab to view more details
For more details about testing with Asenion, you may navigate to Quick Start Guide
Summary
- To use your agents in other applications, it must first be built as an API with frameworks such as FastAPI
- The Bearer Token and API URL are needed to access your agents
- You create your own API Credentials, which allows for more flexibility