Skip to content

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

OpenAI Agents SDK Minion implementations.

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.

Purpose

Configures and executes an OpenAI Agents SDK agent with caller-selected tools, instructions, a model identifier, and a bounded number of model turns. Delegates synchronous, asynchronous, and streaming tool orchestration to the native SDK.

Attributes:

Name Type Description
minion_name str

Default display name for the Minion.

name str

Inherited provider-native agent name.

model str

Inherited model identifier supplied during construction.

instructions str

Inherited system instructions for the workflow.

tools list[Tool]

Inherited native tool objects selected by the caller.

api_key str

OpenAI API key obtained from Minions configuration.

max_turns int

Maximum model turns per execution.

prompt str

Most recently accepted workflow prompt.

run_config RunConfig | None

Explicit model-provider configuration when a key is configured; otherwise the native SDK resolves its authentication and run defaults.

result RunResult | RunResultStreaming | None

Most recent execution result or stream.

Initialize an OpenAI Minion.

Purpose

Initializes the native Agent and wrapper-owned execution state without making a model request. Configured credentials are supplied through the SDK model provider.

Parameters:

Name Type Description Default
model str

Nonblank OpenAI model identifier.

required
instructions str

Nonblank system instructions for the agent.

required
tools Sequence[Tool] | None

Optional native tools; defaults to no tools.

None
max_turns int

Maximum model turns per execution; defaults to 10 and must be positive.

10
name str | None

Optional nonblank name overriding the implementation default.

None

Returns:

Name Type Description
None None

Initializes the Minion and its native agent configuration.

Raises:

Type Description
ValueError

If a required string is invalid or the model-turn limit is not a positive integer.

TypeError

If tools is supplied as an invalid sequence.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

run(prompt: str) -> RunResult

Execute the complete OpenAI workflow synchronously.

Purpose

Runs the configured native agent using the accepted prompt and returns the provider result without changing its type or tool lifecycle.

Parameters:

Name Type Description Default
prompt str

Nonblank user input for the workflow.

required

Returns:

Name Type Description
RunResult RunResult

Provider-native completed run.

Raises:

Type Description
Error

If argument validation or the native runner invocation fails.

Source code in gpt.py
def run( self, prompt: str ) -> RunResult:
	"""Execute the complete OpenAI workflow synchronously.

	Purpose:
		Runs the configured native agent using the accepted prompt and returns the provider
		result without changing its type or tool lifecycle.

	Args:
		prompt (str): Nonblank user input for the workflow.

	Returns:
		RunResult: Provider-native completed run.

	Raises:
		Error: If argument validation or the native runner invocation fails.
	"""
	try:
		throw_if( 'prompt', prompt )
		if not isinstance( prompt, str ):
			raise TypeError( 'Argument "prompt" must be a string!' )
		self.prompt = prompt
		self.result = None
		if self.run_config is None:
			self.result = Runner.run_sync( self, self.prompt, max_turns=self.max_turns )
		else:
			self.result = Runner.run_sync( self, self.prompt, max_turns=self.max_turns, run_config=self.run_config )
		return self.result
	except Error:
		raise
	except Exception as e:
		exception = Error( e )
		exception.module = 'gpt'
		exception.cause = 'Minion'
		exception.method = 'run( self, prompt: str ) -> RunResult'
		Logger( ).write( exception )
		raise exception

run_async(prompt: str) -> RunResult async

Execute the complete OpenAI workflow asynchronously.

Purpose

Runs the configured native agent using the accepted prompt and returns the provider result without changing its type or tool lifecycle.

Parameters:

Name Type Description Default
prompt str

Nonblank user input for the workflow.

required

Returns:

Name Type Description
RunResult RunResult

Provider-native completed run.

Raises:

Type Description
Error

If argument validation or the native runner invocation fails.

Source code in gpt.py
async def run_async( self, prompt: str ) -> RunResult:
	"""Execute the complete OpenAI workflow asynchronously.

	Purpose:
		Runs the configured native agent using the accepted prompt and returns the provider
		result without changing its type or tool lifecycle.

	Args:
		prompt (str): Nonblank user input for the workflow.

	Returns:
		RunResult: Provider-native completed run.

	Raises:
		Error: If argument validation or the native runner invocation fails.
	"""
	try:
		throw_if( 'prompt', prompt )
		if not isinstance( prompt, str ):
			raise TypeError( 'Argument "prompt" must be a string!' )
		self.prompt = prompt
		self.result = None
		if self.run_config is None:
			self.result = await Runner.run( self, self.prompt, max_turns=self.max_turns )
		else:
			self.result = await Runner.run( self, self.prompt, max_turns=self.max_turns, run_config=self.run_config )
		return self.result
	except Error:
		raise
	except Exception as e:
		exception = Error( e )
		exception.module = 'gpt'
		exception.cause = 'Minion'
		exception.method = 'run_async( self, prompt: str ) -> RunResult'
		Logger( ).write( exception )
		raise exception

stream(prompt: str) -> RunResultStreaming

Start a provider-managed streamed workflow.

Purpose

Returns the native stream unchanged so the caller can consume provider events. Errors occurring during later stream consumption are handled by the native SDK and its caller.

Parameters:

Name Type Description Default
prompt str

Nonblank user input for the workflow.

required

Returns:

Name Type Description
RunResultStreaming RunResultStreaming

Native stream with automatic tool handling.

Raises:

Type Description
Error

If argument validation or the native runner invocation fails.

Source code in gpt.py
def stream( self, prompt: str ) -> RunResultStreaming:
	"""Start a provider-managed streamed workflow.

	Purpose:
		Returns the native stream unchanged so the caller can consume provider events. Errors
		occurring during later stream consumption are handled by the native SDK and its caller.

	Args:
		prompt (str): Nonblank user input for the workflow.

	Returns:
		RunResultStreaming: Native stream with automatic tool handling.

	Raises:
		Error: If argument validation or the native runner invocation fails.
	"""
	try:
		throw_if( 'prompt', prompt )
		if not isinstance( prompt, str ):
			raise TypeError( 'Argument "prompt" must be a string!' )
		self.prompt = prompt
		self.result = None
		if self.run_config is None:
			self.result = Runner.run_streamed( self, self.prompt, max_turns=self.max_turns )
		else:
			self.result = Runner.run_streamed( self, self.prompt, max_turns=self.max_turns, run_config=self.run_config )
		return self.result
	except Error:
		raise
	except Exception as e:
		exception = Error( e )
		exception.module = 'gpt'
		exception.cause = 'Minion'
		exception.method = 'stream( self, prompt: str ) -> RunResultStreaming'
		Logger( ).write( exception )
		raise exception

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.

Purpose

Provides the named data agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named governance agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named research agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named software agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named writing agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named planning agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named compliance, legal, and budget agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named business, finance, and marketing agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named image-generation agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named image-analysis agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named image-editing agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named translation agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named transcription agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None

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.

Purpose

Provides the named speech agent specialization while inheriting the native provider execution contract and caller-selected tools from Minion.

Attributes:

Name Type Description
minion_name str

Default display name for this specialization.

Source code in gpt.py
def __init__( self, model: str, instructions: str, tools: Sequence[ Tool ] | None=None, max_turns: int=10, name: str | None=None ) -> None:
	"""Initialize an OpenAI Minion.

	Purpose:
		Initializes the native Agent and wrapper-owned execution state without making a
		model request. Configured credentials are supplied through the SDK model provider.

	Args:
		model (str): Nonblank OpenAI model identifier.
		instructions (str): Nonblank system instructions for the agent.
		tools (Sequence[Tool] | None): Optional native tools; defaults to no tools.
		max_turns (int): Maximum model turns per execution; defaults to 10 and must be positive.
		name (str | None): Optional nonblank name overriding the implementation default.

	Returns:
		None: Initializes the Minion and its native agent configuration.

	Raises:
		ValueError: If a required string is invalid or the model-turn limit is not a positive integer.
		TypeError: If tools is supplied as an invalid sequence.
	"""
	if not isinstance( model, str ) or not model.strip( ):
		raise ValueError( 'Argument "model" must be a nonblank string!' )
	if not isinstance( instructions, str ) or not instructions.strip( ):
		raise ValueError( 'Argument "instructions" must be a nonblank string!' )
	if type( max_turns ) is not int or max_turns < 1:
		raise ValueError( 'Argument "max_turns" must be a positive integer!' )
	agent_name = self.minion_name if name is None else name
	if not isinstance( agent_name, str ) or not agent_name.strip( ):
		raise ValueError( 'Argument "name" must be a nonblank string!' )
	if tools is not None and (not isinstance( tools, Sequence ) or isinstance( tools, (str, bytes, bytearray) )):
		raise TypeError( 'Argument "tools" must be a sequence of native tools!' )
	super( ).__init__( name=agent_name, model=model, instructions=instructions,
		tools=list( tools ) if tools is not None else [ ], )
	self.api_key = cfg.OPENAI_API_KEY
	self.max_turns = max_turns
	self.prompt = ''
	self.run_config = None
	if self.api_key:
		self.run_config = RunConfig( model_provider=OpenAIProvider( api_key=self.api_key ) )
	self.result = None