Skip to content

flue run terminates long-running local agents after ~300s of no SSE events #68

@skylarbpayne

Description

@skylarbpayne

flue run appears to terminate local agent runs after ~300 seconds if the agent is inside a long-running tool call that does not emit Flue-level SSE events before completing.

This shows up as:

[flue] Agent error: terminated

The tool’s own timeout can be much higher than 300s, but the run still terminates around the 300s mark.

Minimal repro

Create a Flue agent that runs a long shell command:

import type { FlueContext } from '@flue/sdk/client';
import { defineCommand } from '@flue/sdk/node';

export const triggers = {};

const bash = defineCommand('bash');

export default async function (ctx: FlueContext<unknown>) {
  const { init } = ctx;

  const agent = await init({
    sandbox: 'local',
    commands: [bash],
  });

  const session = await agent.session('long-bash-probe');

  return await session.shell(
    "bash -lc 'sleep 360; echo done'",
    {
      timeout: 480,
      commands: [bash],
    },
  );
}

Then run:

flue run long-bash-probe \
  --target node \
  --id long-bash-probe \
  --workspace .flue \
  --output /tmp/flue-long-bash-probe

Observed behavior

A 240s sleep succeeds:

session.shell("bash -lc 'sleep 240; echo done'", {
  timeout: 360,
  commands: [bash],
});

Result:

[flue] Done.

A 360s sleep fails at roughly 301 seconds:

session.shell("bash -lc 'sleep 360; echo done'", {
  timeout: 480,
  commands: [bash],
});

Result:

[flue] Agent error: terminated

My interpretation of what's happening here is that the SSE server used in flue has a default timeout of 300s which isn't directly overrideable, and there isn't any continuous keepalive.

P.S. Great work on flue! I love the abstraction here, and super excited to start driving more usage with it! And I'm happy to contribute a fix to this, but would love to discuss what authors/maintainers the preferred approach :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions