Skip to content

Conversation

@tkattkat
Copy link
Collaborator

@tkattkat tkattkat commented Dec 13, 2025

why

update agent docs to reflect new features

what changed

  • docs on abort signal
  • docs on message continuation
  • docs on streaming
  • docs on callbacks

Summary by cubic

Updated Agent docs to cover new experimental capabilities—streaming, callbacks, abort signals, and message continuation—and clarified what’s supported for Computer Use Agents vs non-CUA. This helps build real-time UIs, control execution, and maintain conversation state.

  • New Features

    • Added CUA vs non-CUA feature matrix.
    • Documented streaming mode (stream: true), textStream/fullStream, and AgentStreamResult.
    • Added lifecycle callbacks for non-streaming and streaming, with examples.
    • Added AbortSignal usage, timeout patterns, and streaming abort behavior.
    • Added message continuation via messages in execute options.
    • Updated references: AgentConfig.stream, messages, signal, callbacks, response fields (e.g., messages, timestamp), and new error types.
  • Migration

    • Set experimental: true to use these features; they are not supported with CUA.
    • Enable stream: true for streaming and streaming callbacks; using streaming-only callbacks without streaming will throw.
    • Pass previous result messages to continue conversations; use AbortController.signal to cancel runs.

Written for commit 3b58bf9. Summary will update automatically on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Dec 13, 2025

⚠️ No Changeset found

Latest commit: 3b58bf9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 13, 2025

Greptile Overview

Greptile Summary

Updated agent documentation to reflect four new experimental features available for non-CUA agents:

  • Feature Availability Table: Added clear comparison table showing which features are available for CUA vs non-CUA agents
  • Streaming Mode: Documented stream parameter, AgentStreamResult interface, textStream and fullStream properties with code examples
  • Callbacks: Documented lifecycle callbacks including prepareStep, onStepFinish, onChunk, onFinish, onError, and onAbort with separate tabs for streaming vs non-streaming modes
  • Abort Signal: Documented abort signal support for canceling agent execution with timeout examples
  • Message Continuation: Documented multi-turn conversation support via the messages parameter with chaining examples

The reference documentation was updated with new interface definitions, parameter descriptions, error types, and comprehensive code examples organized in tabs. All examples follow TypeScript conventions and consistently use camelCase naming per project standards.

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • Documentation-only changes with comprehensive coverage of new features, consistent formatting, and adherence to project conventions
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/docs/v3/basics/agent.mdx 5/5 Added comprehensive documentation for experimental agent features: feature availability table, streaming mode, callbacks, abort signals, and message continuation. All examples follow TypeScript conventions and formatting standards.
packages/docs/v3/references/agent.mdx 5/5 Updated API reference with new parameters and interfaces for experimental features: stream, messages, signal, and callbacks. Added new error types and comprehensive code examples in tabs.

Sequence Diagram

sequenceDiagram
    participant User
    participant Agent
    participant LLM
    participant Browser
    
    User->>Agent: execute(instruction, options)
    
    alt With Streaming
        Agent->>User: Return AgentStreamResult
        loop Each Step
            Agent->>LLM: Generate next action
            opt prepareStep callback
                Agent->>User: prepareStep(context)
                User-->>Agent: Modified context
            end
            LLM-->>Agent: Action + reasoning chunks
            opt onChunk callback
                Agent->>User: onChunk(chunk)
            end
            Agent->>Browser: Execute action
            Browser-->>Agent: Action result
            opt onStepFinish callback
                Agent->>User: onStepFinish(event)
            end
        end
        opt onFinish callback
            Agent->>User: onFinish(result)
        end
        Agent->>User: Resolve result promise
    else Without Streaming
        loop Each Step
            Agent->>LLM: Generate next action
            opt prepareStep callback
                Agent->>User: prepareStep(context)
                User-->>Agent: Modified context
            end
            LLM-->>Agent: Action + reasoning
            Agent->>Browser: Execute action
            Browser-->>Agent: Action result
            opt onStepFinish callback
                Agent->>User: onStepFinish(event)
            end
        end
        Agent->>User: Return AgentResult
    end
    
    opt Message Continuation
        User->>Agent: execute(instruction, {messages: previousMessages})
        Note over Agent,LLM: Agent continues conversation<br/>with previous context
    end
    
    opt Abort Signal
        User->>Agent: controller.abort()
        Agent-->>User: Throw AgentAbortError
        opt onAbort callback
            Agent->>User: onAbort(event)
        end
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/docs/v3/references/agent.mdx">

<violation number="1" location="packages/docs/v3/references/agent.mdx:250">
P2: Type documentation inconsistency: `onAbort` ParamField is missing `| Promise&lt;void&gt;` return type that&#39;s present in the interface definition above. This could mislead users into thinking they cannot use async handlers.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

<ParamField path="onError" type="StreamTextOnErrorCallback" optional>
Called when an error occurs during streaming.
</ParamField>
<ParamField path="onAbort" type="(event: { steps: StepResult[] }) => void" optional>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Type documentation inconsistency: onAbort ParamField is missing | Promise<void> return type that's present in the interface definition above. This could mislead users into thinking they cannot use async handlers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/v3/references/agent.mdx, line 250:

<comment>Type documentation inconsistency: `onAbort` ParamField is missing `| Promise&lt;void&gt;` return type that&#39;s present in the interface definition above. This could mislead users into thinking they cannot use async handlers.</comment>

<file context>
@@ -157,9 +205,60 @@ interface AgentExecuteOptions {
+    &lt;ParamField path=&quot;onError&quot; type=&quot;StreamTextOnErrorCallback&quot; optional&gt;
+      Called when an error occurs during streaming.
+    &lt;/ParamField&gt;
+    &lt;ParamField path=&quot;onAbort&quot; type=&quot;(event: { steps: StepResult[] }) =&gt; void&quot; optional&gt;
+      Called when the stream is aborted via the `signal` option.
+    &lt;/ParamField&gt;
</file context>
Suggested change
<ParamField path="onAbort" type="(event: { steps: StepResult[] }) => void" optional>
<ParamField path="onAbort" type="(event: { steps: StepResult[] }) => void | Promise<void>" optional>

✅ Addressed in 3b58bf9

@seanmcguire12 seanmcguire12 merged commit e2884dd into main Dec 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants