Rendyn

Component library

189 components

Agent UI

Agent Activity

Agent Activity renders supplied event items and an application-owned task status.

React Tailwind CSS

Practical React example

Summarize a task’s actual tool, search and step events in a compact activity view.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/agents/agent-activity/index.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Summarize a task’s actual tool, search and step events in a compact activity view

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";

import { RotateCcw } from "lucide-react";
import { useReducedMotion } from "motion/react";
import { useEffect, useState } from "react";
import {
  AgentActivity,
  type AgentActivityItem,
} from "@/components/agents/agent-activity";

const REASONING = [
  "Reading the request and separating the content model from its presentation.",
  "The activity shell can stay consistent while each event supplies its own compact renderer.",
  "Text remains freeform so partial tokens can update without recreating the surrounding timeline.",
  "As each sentence wraps, the measured stream moves upward through a single transform instead of repeatedly jumping the native scroll position.",
  "Older context stays available above the fold while the newest tokens remain crisp at the bottom edge.",
  "Once the run finishes, the viewport switches from automatic following to ordinary user-controlled scrolling.",
  "Opening the completed disclosure returns to the beginning so the reasoning can be read in order.",
  "The capped viewport follows the latest sentence and preserves the full log after completion.",
].join("\n");

const CHARACTERS_PER_SECOND = 90;
const STREAM_SECONDS = REASONING.length / CHARACTERS_PER_SECOND;

function StreamingTextDemo() {
  const reduce = useReducedMotion() ?? false;
  const [stream, setStream] = useState("");
  const [complete, setComplete] = useState(false);

  useEffect(() => {
    if (reduce) {
      setStream(REASONING);
      setComplete(true);
      return;
    }

    const startedAt = performance.now();
    let frame = 0;
    let completionTimer: number | undefined;

    const streamNextFrame = (now: number) => {
      const cursor = Math.min(
        REASONING.length,
        Math.floor(((now - startedAt) / 1000) * CHARACTERS_PER_SECOND),
      );
      const next = REASONING.slice(0, cursor);
      setStream((current) => (current === next ? current : next));

      if (cursor === REASONING.length) {
        completionTimer = window.setTimeout(() => setComplete(true), 500);
      } else {
        frame = requestAnimationFrame(streamNextFrame);
      }
    };

    frame = requestAnimationFrame(streamNextFrame);
    return () => {
      cancelAnimationFrame(frame);
      if (completionTimer) window.clearTimeout(completionTimer);
    };
  }, [reduce]);

  const items: AgentActivityItem[] = stream
    .split("\n")
    .filter(Boolean)
    .map((content, index) => ({
      id: `reasoning-${index}`,
      type: "text",
      content,
    }));

  return (
    <AgentActivity
      items={items}
      contentType="text"
      status={complete ? "complete" : "working"}
      duration={STREAM_SECONDS}
      defaultOpen={reduce}
      collapseOnComplete={!reduce}
      maxHeight={180}
    />
  );
}

export function AgentActivityTextPreview() {
  const [run, setRun] = useState(0);

  return (
    <div className="relative h-[330px] w-full max-w-lg">
      <StreamingTextDemo key={run} />
      <button
        type="button"
        onClick={() => setRun((current) => current + 1)}
        className="absolute bottom-0 left-0 inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
      >
        <RotateCcw className="size-3" />
        Replay
      </button>
    </div>
  );
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

Map backend events to stable IDs and distinguish working, completed and failed task states in your integration. Keep duration tied to the real task clock.

Customization

AgentActivityProps.items
Required; AgentActivityItem[]. Chronological activity entries. Append or update items as events stream.
AgentActivityProps.contentType
Optional; AgentActivityContentType. Expected activity kind before the first streamed item arrives.
AgentActivityProps.status
Optional; AgentActivityStatus. Current run phase. Active runs always stay expanded.
AgentActivityProps.duration
Optional; number. Elapsed run time, in seconds. Used by the step-only summary.
AgentActivityProps.open
Optional; boolean. Controlled expanded state used after the run completes.
AgentActivityProps.defaultOpen
Optional; boolean. Initial expanded state used after the run completes.
AgentActivityProps.onOpenChange
Optional; (open: boolean) => void. Called when the completed activity disclosure changes state.
AgentActivityProps.collapseOnComplete
Optional; boolean. Collapse the disclosure when status changes from working to complete.
AgentActivityProps.activeLabel
Optional; ReactNode. Optional label shown while the run is active.
AgentActivityProps.summary
Optional; ReactNode. Optional completed summary. Derived from the item types by default.
AgentActivityProps.renderWorkingStatus
Optional; (context: { label: ReactNode; duration: number; }) => ReactNode. Optional renderer for the contents of the active status row.
AgentActivityProps.renderCompletedStatus
Optional; (context: { summary: ReactNode; duration: number; }) => ReactNode. Optional renderer for the contents before the built-in disclosure chevron.
AgentActivityProps.maxHeight
Optional; number. Maximum visible activity height before the stream begins gliding.
AgentActivityProps.className
Optional; string.

Integration notes

  • Do not present invented reasoning traces as an agent’s actual internal process.
  • Filter sensitive tool arguments and output before exposing activity to a viewer.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP