Skip to content

Introduce AgentWorkflow module for chained tool calling #52

@interstellarninja

Description

@interstellarninja

Feature Request: Workflow Module for MarketAgent Framework

Objective

  • Allow defining workflows as a state machine or Directed Acyclic Graph (DAG) with tools.
  • Enable chaining tools, passing outputs between steps as inputs to the next.
  • Integrate with the existing MarketAgent class as an attribute (and cognitive steps such as perception, action, and reflection).
  • Use OpenAI function calling for generating and validating tool calls.

Key Components

WorkflowObject

  • Defines steps and tool dependencies.

WorkflowExecutor

  • Executes step-by-step tools in the workflow using LLMs.

ToolRegistry

  • Stores callable tools with their OpenAI function-calling schema.

Workflow Design

Steps

Each step in the workflow defines:

  1. Tool to invoke: Specifies which tool to execute.
  2. Input schema: Static values or outputs from previous steps.
  3. Error handling: Defines fallback actions or recovery strategies.

Example

workflow = WorkflowDefinition(steps=[
    {"id": "step1", "tool": "get_market_data", "inputs": {}},
    {"id": "step2", "tool": "analyze_market", "inputs": {"data": "step1.result"}},
    {"id": "step3", "tool": "place_order", "inputs": {"decision": "step2.result"}}
])

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions