Skip to content

Tool

StructureRunClient

Bases: BaseTool

Attributes:

Name Type Description
description str

A description of what the Structure does.

driver BaseStructureRunDriver

Driver to run the Structure.

Source code in griptape/tools/structure_run_client/tool.py
@define
class StructureRunClient(BaseTool):
    """
    Attributes:
        description: A description of what the Structure does.
        driver: Driver to run the Structure.
    """

    description: str = field(kw_only=True)
    driver: BaseStructureRunDriver = field(kw_only=True)

    @activity(
        config={
            "description": "Can be used to run a Griptape Structure with the following description: {{ self.description }}",
            "schema": Schema(
                {Literal("args", description="A list of string arguments to submit to the Structure Run"): list}
            ),
        }
    )
    def run_structure(self, params: dict) -> BaseArtifact:
        args: list[str] = params["values"]["args"]

        return self.driver.run(*[TextArtifact(arg) for arg in args])

description: str = field(kw_only=True) class-attribute instance-attribute

driver: BaseStructureRunDriver = field(kw_only=True) class-attribute instance-attribute

run_structure(params)

Source code in griptape/tools/structure_run_client/tool.py
@activity(
    config={
        "description": "Can be used to run a Griptape Structure with the following description: {{ self.description }}",
        "schema": Schema(
            {Literal("args", description="A list of string arguments to submit to the Structure Run"): list}
        ),
    }
)
def run_structure(self, params: dict) -> BaseArtifact:
    args: list[str] = params["values"]["args"]

    return self.driver.run(*[TextArtifact(arg) for arg in args])