Assembly: minions
Filename: claude.py
Author: Terry D. Eppler
Created: 09-05-2026
Last Modified By: Terry D. Eppler
Last Modified On: 09-06-2026
claude.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
Anthropic Claude Minion implementations.
Minion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Claude workflow agent backed by Anthropic's native tool runner.
Initialize a Claude Minion.
Parameters:
| Name |
Type |
Description |
Default |
model
|
str
|
|
required
|
instructions
|
str
|
System instructions for the agent.
|
required
|
tools
|
Sequence[ClaudeTool] | None
|
Optional Anthropic local or server tools.
|
None
|
max_turns
|
int
|
Maximum model iterations per execution.
|
10
|
max_tokens
|
int
|
Maximum output tokens per model iteration.
|
4096
|
api_key
|
str | None
|
Optional Anthropic API key override.
|
None
|
name
|
str | None
|
Optional name overriding the implementation default.
|
None
|
Returns:
| Name | Type |
Description |
None |
None
|
Configuration and native clients are stored.
|
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
Create an async adapter without changing the provider schema.
Parameters:
| Name |
Type |
Description |
Default |
tool
|
BetaFunctionTool
|
Synchronous Anthropic beta tool.
|
required
|
Returns:
| Name | Type |
Description |
BetaAsyncFunctionTool |
BetaAsyncFunctionTool
|
Schema-identical asynchronous tool.
|
Source code in claude.py
| def create_async_tool( self, tool: BetaFunctionTool ) -> BetaAsyncFunctionTool:
"""Create an async adapter without changing the provider schema.
Args:
tool (BetaFunctionTool): Synchronous Anthropic beta tool.
Returns:
BetaAsyncFunctionTool: Schema-identical asynchronous tool.
"""
async def invoke( **arguments: object ) -> object:
return await asyncio.to_thread( tool.func, **arguments )
invoke.__name__ = tool.name
invoke.__doc__ = tool.description
return beta_async_tool( invoke, name=tool.name, description=tool.description,
input_schema=tool.input_schema, )
|
run(prompt: str) -> BetaMessage
Execute the complete Claude workflow synchronously.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
User input for the workflow.
|
required
|
Returns:
| Name | Type |
Description |
BetaMessage |
BetaMessage
|
Final provider-native message.
|
Source code in claude.py
| def run( self, prompt: str ) -> BetaMessage:
"""Execute the complete Claude workflow synchronously.
Args:
prompt (str): User input for the workflow.
Returns:
BetaMessage: Final provider-native message.
"""
throw_if( 'prompt', prompt )
runner = self.client.beta.messages.tool_runner( model=self.model,
max_tokens=self.max_tokens, max_iterations=self.max_turns, system=self.instructions,
tools=self.tools, messages=[ { 'role': 'user', 'content': prompt } ], )
result = runner.until_done( )
self.result = result
return self.result
|
run_async(prompt: str) -> BetaMessage
async
Execute the complete Claude workflow asynchronously.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
User input for the workflow.
|
required
|
Returns:
| Name | Type |
Description |
BetaMessage |
BetaMessage
|
Final provider-native message.
|
Source code in claude.py
| async def run_async( self, prompt: str ) -> BetaMessage:
"""Execute the complete Claude workflow asynchronously.
Args:
prompt (str): User input for the workflow.
Returns:
BetaMessage: Final provider-native message.
"""
throw_if( 'prompt', prompt )
runner = self.async_client.beta.messages.tool_runner(
model=self.model,
max_tokens=self.max_tokens,
max_iterations=self.max_turns,
system=self.instructions,
tools=self.async_tools,
messages=[ { 'role': 'user', 'content': prompt } ],
)
result = await runner.until_done( )
self.result = result
return result
|
stream(prompt: str) -> BetaAsyncStreamingToolRunner[object]
Start Anthropic's complete async streaming tool runner.
Parameters:
| Name |
Type |
Description |
Default |
prompt
|
str
|
User input for the workflow.
|
required
|
Returns:
| Type |
Description |
BetaAsyncStreamingToolRunner[object]
|
BetaAsyncStreamingToolRunner[object]: Native runner that streams and executes tools.
|
Source code in claude.py
| def stream( self, prompt: str ) -> BetaAsyncStreamingToolRunner[ object ]:
"""Start Anthropic's complete async streaming tool runner.
Args:
prompt (str): User input for the workflow.
Returns:
BetaAsyncStreamingToolRunner[object]: Native runner that streams and executes tools.
"""
throw_if( 'prompt', prompt )
runner = self.async_client.beta.messages.tool_runner(
model=self.model,
max_tokens=self.max_tokens,
max_iterations=self.max_turns,
system=self.instructions,
tools=self.async_tools,
messages=[ { 'role': 'user', 'content': prompt } ],
stream=True,
)
self.result = runner
return runner
|
DataMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for data workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
GovernanceMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for governance workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
ResearchMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for research workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
CodingMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for software workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
WritingMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for writing workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
PlanningMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for planning workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
ComplianceMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for compliance, legal, and budget workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
BusinessMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for business, finance, and marketing workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
ImageGenerationMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for image-generation workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
ImageAnalysisMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for image-analysis workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
ImageEditingMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for image-editing workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
TranslationMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for translation workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
TranscriptionMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for transcription workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|
SpeechMinion(model: str, instructions: str, tools: Sequence[ClaudeTool] | None = None, max_turns: int = 10, max_tokens: int = 4096, api_key: str | None = None, name: str | None = None)
Bases: Minion
Claude Minion specialized for speech workflows.
Source code in claude.py
| def __init__( self, model: str, instructions: str,
tools: Sequence[ ClaudeTool ] | None=None, max_turns: int=10,
max_tokens: int=4096, api_key: str | None=None,
name: str | None=None ) -> None:
"""Initialize a Claude Minion.
Args:
model (str): Claude model identifier.
instructions (str): System instructions for the agent.
tools (Sequence[ClaudeTool] | None): Optional Anthropic local or server tools.
max_turns (int): Maximum model iterations per execution.
max_tokens (int): Maximum output tokens per model iteration.
api_key (str | None): Optional Anthropic API key override.
name (str | None): Optional name overriding the implementation default.
Returns:
None: Configuration and native clients are stored.
"""
throw_if( 'model', model )
throw_if( 'instructions', instructions )
if max_turns < 1:
raise ValueError( 'Argument "max_turns" must be at least 1!' )
if max_tokens < 1:
raise ValueError( 'Argument "max_tokens" must be at least 1!' )
self.name = name or self.minion_name
throw_if( 'name', self.name )
self.model = model
self.instructions = instructions
self.tools = list( tools or [ ] )
self.max_turns = max_turns
self.max_tokens = max_tokens
self.api_key = api_key or os.getenv( 'ANTHROPIC_API_KEY' )
throw_if( 'api_key', self.api_key )
self.async_tools: list[ ClaudeAsyncTool ] = [
self.create_async_tool( tool ) if isinstance( tool, BetaFunctionTool ) else tool
for tool in self.tools
]
self.client = Anthropic( api_key=self.api_key )
self.async_client = AsyncAnthropic( api_key=self.api_key )
self.result: BetaMessage | BetaAsyncStreamingToolRunner[ object ] | None = None
|