Skip to content

subagents: cannot start workflows #1359

@kamranayub

Description

@kamranayub

Describe the bug

I was trying to build off the experimental/gadgets-subagents and examples/workflows to combine them. I basically wanted a sub agent to kick off and own a workflow.

I had an AgentWorkflow named FlightSearchWorkflow and a TripPlannerAgent parent agent.

I defined a FlightSearchAgent and had code like this in a method:

async runFlightSearch(task: string) {
  console.log("Running flight search workflow...");
  const instanceId = await this.runWorkflow("FLIGHT_SEARCH_WORKFLOW", { task });
  console.log("Started flight search workflow with instanceId:", instanceId);

  // ...
}

It never got to the second log, instead it threw an error:

Could not detect Agent binding name from class name. Pass it explicitly via options.agentBinding

To Reproduce
Steps to reproduce the behavior:

  1. Create and export an AgentWorkflow that does a step
  2. Create an Agent
  3. Create a subagent with a doSomething method that calls this.runWorkflow and export it
  4. In the parent agent, call this.subAgent to get it
  5. Invoke the doSomething method
  6. See error

(Assuming all Wrangler setup is there)

Expected behavior

Subagents should be able to a workflow AgentFlow functionality the same way a top-level Agent does.

Version:
0.11.4

Additional context

  "dependencies": {
    "@cloudflare/ai-chat": "*",
    "@cloudflare/kumo": "^1.19.0",
    "@phosphor-icons/react": "^2.1.10",
    "agents": "^0.11.4",
    "ai": "^6.0.168",
    "react": "^19.2.5",
    "react-dom": "^19.2.5",
    "workers-ai-provider": "^3.1.11"
  },
  "devDependencies": {
    "@cloudflare/vite-plugin": "^1.33.1",
    "@cloudflare/workers-types": "^4.20260422.1",
    "@tailwindcss/vite": "^4",
    "@types/node": "^25.6.0",
    "@types/react": "^19.2.14",
    "@types/react-dom": "^19.2.3",
    "@vitejs/plugin-react": "^6.0.1",
    "tailwindcss": "^4.2.2",
    "vite": "^8.0.9"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingon the roadmapFeature accepted and planned for implementation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions