Skip to content

job-events.md agent example passes 'ct' positionally after named args / wrong param name #56

@nficano

Description

@nficano

Category: docs Severity: major
Location: docs/guides/job-events.md:29-43

What

The cancellation parameter is named cancellationToken on these methods (JobContext.cs ToolCallAsync:110, ToolResultAsync:134, ProgressAsync:195). Passing a positional ct after named arguments is a compile error in C#, and elsewhere the example uses ct: ct referencing a non-existent parameter name.

Evidence

    await ctx.ToolCallAsync("fetch", callId: "c1",
        args: new { url = "https://api.example.com/data" }, ct);
    var data = /* ... */ "";
    await ctx.ToolResultAsync("c1", result: data, ct);

    await ctx.ProgressAsync(current: 1, total: 3, message: "fetched", ct);

Proposed fix

Pass cancellationToken: ct (named) in each call, e.g. ctx.ToolResultAsync("c1", result: data, cancellationToken: ct).

Acceptance criteria

  • The agent example compiles using the real parameter name cancellationToken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit/docsAudit: documentation inaccuracysev/majorSeverity: major

    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