griptape icon indicating copy to clipboard operation
griptape copied to clipboard

Change the Paradigm of Pipelines to take Agents as inputs and chain data between them.

Open jimatregrello opened this issue 1 year ago • 2 comments

As I've continued to use griptape, the paradigm of using PromptTasks inside of broader request contexts is becoming repetitive and not as clean as using Agents. I'm slowly articulating prompts in the form of responsibilities for specific agents and rather than re-setting this up in a pipeline, I'd rather be able to chain prompts between agents in the form of a pipeline. Rulesets allow me to assign responsibilities in a nice programmatic format and I'd like to keep that.

This programming model enables users to treat agents similarly to actors with Pipelines essentially enabling message passing between the respective agents. For example, I have one agent that summarizes a prompt based on a ruleset and another agent that acts on the summarized prompt with its own ruleset.

It'd be nice to define agents and simply chain their I/O in the following form:

summarize_agent = SummarizeAgent()...
parse_agent = ParseAgent()...
pipeline = Pipeline()
pipeline.chain(
    summarize_agent.prompt(input),
    parse_agent.prompt('{{ parent_output }}')
)

This enables me to build agents in isolation and test their input and output and then chain them together.

jimatregrello avatar Jan 12 '24 04:01 jimatregrello

Hey @jimatregrello thanks for trying out Griptape, and for the great feedback! This is something we've been playing with internally, I think need a StructureRunnerTask and StructureRunnerTool. That would enable something like:

input = "foo bar"
summarize_agent = SummarizeAgent()
parse_agent = ParseAgent()
query_agent_a = QueryAgent()
query_agent_b = QueryAgent() 

pipeline = Pipeline(
    tasks=[
        StructureRunnerTask(input, summarize_agent),
        StructureRunnerTask("{{ parent_output }}", parse_agent),
        ToolkitTask(
            "{{ parent_output }}",
            tools=[
                StructureRunnerTool(structure=query_agent_a),
                StructureRunnerTool(structure=query_agent_b),
            ]
        )
    ]
)
pipeline.run()

collindutter avatar Jan 12 '24 16:01 collindutter

Sure thing.

To provide more context, we have instances where we may want to fine tune models for individual agents before chaining and that's where this will be a huge help.

jimatregrello avatar Jan 12 '24 17:01 jimatregrello

Hey @jimatregrello we've recently introduced a handful of framework features that enables multi-agent orchestration. You can see an example here.

Closing this item for now but please let us know if you have any questions!

collindutter avatar May 28 '24 17:05 collindutter