Skip to content

Add built-in execution timeout and cancellation support for long-running agent actions #894

@poniescollie

Description

@poniescollie

Language Implementation

  • Python
  • TypeScript

Feature Type

  • Action Provider Template
  • Wallet Provider Template
  • Framework Extension
  • Core Requirements
  • Other

🚀 The feature, motivation and pitch

AgentKit agents may execute long-running or multi-step actions (onchain calls, polling, retries, external API requests). Currently, there is no first-class way to apply execution timeouts or cancel in-progress actions, which can lead to stalled agents and wasted resources.

Problem Description

In real-world deployments:

  • An action may hang due to slow RPC responses or external service delays.
  • Agents may need to stop execution when a user cancels a task or a higher-level timeout is reached.
  • Developers must manually implement cancellation logic using custom flags or wrappers.

Alternatives

Proposed Solution

  • Add optional execution timeout configuration at two levels:
    • global default during AgentKit initialization
    • per-action override when invoking an action
  • Support cancellation using a standard mechanism such as AbortSignal.
  • Propagate cancellation and timeout signals to:
    • retries
    • polling loops
    • underlying RPC or external API calls
  • Emit a distinct, typed error for timeout and cancellation events.

Acceptance Criteria

  • Long-running actions terminate automatically when the timeout is reached.
  • Manual cancellation cleanly stops all in-progress work.
  • Consumers receive clear, typed timeout or cancellation errors.
  • Existing agents continue to work unchanged when no timeout is configured.
  • Unit tests cover timeout expiration and cancellation paths.

Additional context

Example code

import { AgentKit } from "@coinbase/agentkit";

const agent = new AgentKit({
  // desired: global timeout / cancellation config
});

await agent.evm.sendTransaction({
  network: "base",
  to: "0x...",
  value: "0",
  data: "0x",
  // desired: per-action timeout
});

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