Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/tools/code_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async def main():
instructions="You love doing math.",
tools=[
CodeInterpreterTool(
tool_config={"type": "code_interpreter", "container": {"type": "auto"}},
tool_config={"type": "code_interpreter", "container": {"type": "auto"}}
)
],
)
Expand Down
6 changes: 1 addition & 5 deletions examples/tools/image_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ async def main():
agent = Agent(
name="Image generator",
instructions="You are a helpful agent.",
tools=[
ImageGenerationTool(
tool_config={"type": "image_generation", "quality": "low"},
)
],
tools=[ImageGenerationTool(tool_config={"type": "image_generation", "quality": "low"})],
)

with trace("Image generation example"):
Expand Down
12 changes: 12 additions & 0 deletions src/agents/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ class HostedMCPTool:
def name(self):
return "hosted_mcp"

def __post_init__(self):
if "type" not in self.tool_config:
self.tool_config["type"] = "mcp"


@dataclass
class CodeInterpreterTool:
Expand All @@ -205,6 +209,10 @@ class CodeInterpreterTool:
def name(self):
return "code_interpreter"

def __post_init__(self):
if "type" not in self.tool_config:
self.tool_config["type"] = "code_interpreter"


@dataclass
class ImageGenerationTool:
Expand All @@ -217,6 +225,10 @@ class ImageGenerationTool:
def name(self):
return "image_generation"

def __post_init__(self):
if "type" not in self.tool_config:
self.tool_config["type"] = "image_generation"


@dataclass
class LocalShellCommandRequest:
Expand Down