OpenAI API¶
OpenAI Minions inherit agents.Agent and use agents.Runner for synchronous, asynchronous, and
streaming execution.
gpt
¶
Assembly: minions Filename: gpt.py Author: Terry D. Eppler Created: 09-05-2026
Last Modified By: Terry D. Eppler Last Modified On: 09-06-2026
gpt.py
Copyright © 2026 Terry D. Eppler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You can contact me at: terryeppler@gmail.com or eppler.terry@epa.gov
Minion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Agent
Provider-native OpenAI workflow agent.
Initialize an OpenAI Minion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
OpenAI model identifier. |
required |
instructions
|
str
|
System instructions for the agent. |
required |
tools
|
Sequence[Tool] | None
|
Optional OpenAI Agents SDK tools. |
None
|
max_turns
|
int
|
Maximum model turns per execution. |
10
|
name
|
str | None
|
Optional name overriding the implementation default. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
Configuration is stored on the provider-native agent. |
Source code in gpt.py
run(prompt: str) -> RunResult
¶
Execute the complete OpenAI workflow synchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
User input for the workflow. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RunResult |
RunResult
|
Provider-native completed run. |
Source code in gpt.py
run_async(prompt: str) -> RunResult
async
¶
Execute the complete OpenAI workflow asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
User input for the workflow. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RunResult |
RunResult
|
Provider-native completed run. |
Source code in gpt.py
stream(prompt: str) -> RunResultStreaming
¶
Start a provider-managed streamed workflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
User input for the workflow. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RunResultStreaming |
RunResultStreaming
|
Native stream with automatic tool handling. |
Source code in gpt.py
DataMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for data workflows.
Source code in gpt.py
GovernanceMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for governance workflows.
Source code in gpt.py
ResearchMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for research workflows.
Source code in gpt.py
CodingMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for software workflows.
Source code in gpt.py
WritingMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for writing workflows.
Source code in gpt.py
PlanningMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for planning workflows.
Source code in gpt.py
ComplianceMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for compliance, legal, and budget workflows.
Source code in gpt.py
BusinessMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for business, finance, and marketing workflows.
Source code in gpt.py
ImageGenerationMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for image-generation workflows.
Source code in gpt.py
ImageAnalysisMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for image-analysis workflows.
Source code in gpt.py
ImageEditingMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for image-editing workflows.
Source code in gpt.py
TranslationMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for translation workflows.
Source code in gpt.py
TranscriptionMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for transcription workflows.
Source code in gpt.py
SpeechMinion(model: str, instructions: str, tools: Sequence[Tool] | None = None, max_turns: int = 10, name: str | None = None)
¶
Bases: Minion
OpenAI Minion specialized for speech workflows.