Skip to content

Expose deterministic action IDs and lifecycle events for agent execution #892

@yeastybunks

Description

@yeastybunks

Overview

AgentKit allows agents to perform complex, multi-step onchain actions, but there is currently no standardized way to identify, track, or correlate individual actions across logs, retries, and execution steps. This makes debugging, observability, and analytics harder in real-world deployments.

Problem Description

When an agent performs multiple actions (e.g., read → simulate → send transaction → wait for confirmation), developers often need to:

  • correlate logs belonging to the same logical action
  • track retries and partial failures
  • emit analytics or telemetry events tied to a single action
  • debug long-running or asynchronous agent behavior

Without deterministic action identifiers and lifecycle hooks, each integration tends to implement its own ad-hoc tracking.

Expected Behavior

  • Each agent action should have a deterministic, unique action ID.
  • Developers should be able to subscribe to action lifecycle events (start, retry, success, failure).
  • Lifecycle events should include structured context and error metadata.

Steps to Reproduce

  1. Run an agent that executes multiple onchain actions in sequence.
  2. Introduce a transient failure causing retries.
  3. Attempt to correlate logs for a single action across retries.
  4. Observe that there is no built-in action identifier or lifecycle hook.

Example code

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

const agent = new AgentKit({
  // config...
});

agent.onAction((event) => {
  console.log(event.actionId, event.type, event.metadata);
});

await agent.evm.sendTransaction({
  network: "base",
  to: "0x...",
  value: "0",
});

Proposed Solution

  • Generate a deterministic actionId for each high-level agent action.
  • Emit lifecycle events:
  • action:start
  • action:retry
  • action:success
  • action:failure
  • Include structured metadata:
  • provider type (RPC/CDP)
  • retry count
  • error classification
  • timestamps
  • Expose a simple subscription API for consumers.

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