Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
ad9f99f
add totalChunks to metadata for tracing
Jul 6, 2025
e5d713e
improve RAG retrieval process
Jul 6, 2025
67b4cce
POC UI for chat based documentation
Jul 7, 2025
d681935
update Start / Continue course
Jul 7, 2025
6ee3313
expand text
Jul 7, 2025
5611093
fix scrollbar problem and chat input resizing
Jul 8, 2025
ce7526b
adding progress tracker
Jul 9, 2025
a8b504c
center the progress bar
Jul 9, 2025
cebfc57
testing out new terminal component and websocket servert
Jul 10, 2025
50c278e
fix terminal issue not staying on
Jul 10, 2025
c58d589
fix weird terminal display
Jul 10, 2025
bf2fcf7
fix self is not defined error
Jul 10, 2025
5f3bace
remove unnecessary terminal message
Jul 10, 2025
8660bc7
typo
Jul 10, 2025
eca2c37
fix weird flow
Jul 10, 2025
a3892ab
remove duplicated butotn
Jul 10, 2025
1d485f3
playing with coding web server
Jul 12, 2025
f26495a
remove websocket server
Jul 13, 2025
1b15fbc
creating api for tutorials
Jul 14, 2025
31e8c76
fix interface
Jul 14, 2025
365f727
modify tutorials workflow -- vibecoded
Jul 14, 2025
6e3be4a
dummy demo code execution api next.js
Jul 16, 2025
c515da8
New pulse agent using response api tools calling
Jul 18, 2025
b33e8a8
re-build the entire Pulse agent with new design
Jul 19, 2025
e4b3fdf
adding tutorial step workflow
Jul 20, 2025
6797932
simplify tutorial reader to have consistent api
Jul 20, 2025
48afdba
cleaning up some more steps
Jul 20, 2025
b7e4cec
breaking frontend to smaller components;
Jul 21, 2025
f104ea7
link doc-qa to pulse agent
Jul 23, 2025
eec9e12
removing unused import
Jul 24, 2025
7fccea4
fix chat input box and have split pane for code editor
Jul 26, 2025
283999b
enhancing file display
Jul 26, 2025
4e45656
simplify chat interface -- removing unnecessary code block displays
Jul 27, 2025
b92dc22
add editor close button
Jul 27, 2025
ebf4b0a
make side bar icons smaller
Jul 27, 2025
c018ffa
implement chunk streaming structure
Jul 29, 2025
15b9443
clean up some items
Jul 31, 2025
8f0db92
Revert "Implement Copy Page Dropdown Functionality (#239)"
Jul 31, 2025
93fd5c2
fix tutorial step data handling issue
Jul 31, 2025
211ddfd
add kv store api service
Aug 2, 2025
9ef8231
remove unused interfaces
Aug 2, 2025
7e26af4
remove unneeded conversation type
Aug 2, 2025
40e9185
reformat chat history
Aug 15, 2025
2ef1cbc
add kv store api
Aug 15, 2025
5db648a
Simplify and refactor chat to connect with kv store
Aug 15, 2025
01e7e1c
add uuid package
Aug 15, 2025
ab43821
update example env
Aug 15, 2025
f79b636
share session context
Aug 15, 2025
ea5014f
removing debug
Aug 16, 2025
39c4d2f
Adding session cache with SWR
Aug 16, 2025
d1c4d9b
add .env to gitignore
Aug 16, 2025
61e9b76
Merge branch 'main' of https://github.com/agentuity/docs
Aug 16, 2025
7ac791c
Merge branch 'main' into seng/chat-prototype
Aug 16, 2025
9b1b3d7
sync with main
Aug 16, 2025
fcca3e5
adjust chat message area width and dynamic spacing with sessionsbar
afterrburn Aug 17, 2025
0efd14e
add code editor content
Aug 17, 2025
5500fdb
remove redundant comments
Aug 18, 2025
e1704d6
display tutorial instruction content
Aug 18, 2025
6920ec6
add user based session management
Aug 20, 2025
d3ea19a
enable split pane resize
Aug 20, 2025
26df331
adding sessions cursor
Aug 21, 2025
28404a6
sessions paginated loading
Aug 21, 2025
92edc6b
clean up env variables
Aug 21, 2025
394ebfc
enabling direct llm access flag
afterrburn Aug 28, 2025
312e679
add title generation
afterrburn Sep 4, 2025
c61d03c
remove session update redundancy
Sep 4, 2025
9e51545
render session messages directly
Sep 4, 2025
02e53f3
fix streaming bug on UI
Sep 5, 2025
01da75a
Merge branch 'main' into seng/chat-prototype
Sep 5, 2025
8635791
merge conflict resolution
Sep 5, 2025
e9c36dd
remove tutorial agent set up that is not currently needed
Sep 5, 2025
1976c37
remove package json
Sep 5, 2025
528f6f9
rebuilt package json and remove /api/chat and /api/terminal that were…
Sep 5, 2025
bd1ebcf
delete dummy terminal websocket server
Sep 5, 2025
2c0bb5f
Add tutorial structure rules and enhance tutorial API responses
Sep 8, 2025
4e7f555
chore(lockfile): sync package-lock with package.json to fix npm ci (a…
Sep 8, 2025
3719399
sync package
Sep 8, 2025
c99c487
fix build error
Sep 8, 2025
cf066f6
synchronize name of totalSteps
Sep 10, 2025
8a14f69
fix linter failure
Sep 10, 2025
bd8636e
cleaning up debug log and unused modules
Sep 10, 2025
db8bc5c
remove debug log from ChatMessage
Sep 10, 2025
05e0c82
remove dummy tutorial content
Sep 10, 2025
9d5b733
simplify code pieces
Sep 10, 2025
534c044
add total steps
Sep 10, 2025
5739771
remove unused components
Sep 10, 2025
be45ee2
removing unused module
Sep 10, 2025
9e9c10c
Remove integration md
Sep 10, 2025
1a9dcae
replace div with interactable button
Sep 10, 2025
b3e832f
remove unused import
Sep 10, 2025
8b4f8ac
toIsoString formatting
Sep 10, 2025
bbfdd4a
gracefully handle setKVValue error
Sep 11, 2025
28abcdb
improve tool param wording
Sep 12, 2025
fd56f01
remove unused websocket server
Sep 12, 2025
4133dab
add user tutorial status
Sep 12, 2025
678297f
add tutorial state management
Sep 12, 2025
fd066fe
refactor tutorial state route handlers to improve JSON body parsing a…
Sep 13, 2025
71d7b19
update ChatMessage component to format code snippets with labels abov…
Sep 13, 2025
61aaac7
remove python tutorial mdx
Sep 13, 2025
4c86313
Fix CodeRabbit issues: implement validation middleware and improve er…
devin-ai-integration[bot] Sep 14, 2025
5676ba8
Apply suggestion from @coderabbitai[bot]
afterrburn Sep 14, 2025
07a20fd
fix typo
Sep 14, 2025
a8dd208
clean up
Sep 14, 2025
84e2e6d
Merge branch 'main' into seng/chat-prototype
Sep 14, 2025
92e4294
small fixes
Sep 15, 2025
f2cdb42
revert css
Sep 15, 2025
a886586
remove tutorial
Sep 15, 2025
81e5019
remove Tutorial page
Sep 15, 2025
5f43898
remove outdated readme
Sep 15, 2025
a2ffc61
remove unnecessary dependencies
Sep 15, 2025
6d3264a
remove debug logging
Sep 15, 2025
6d70c4e
example of how tutorial is structured
Sep 15, 2025
50e0158
Revert "example of how tutorial is structured"
Sep 16, 2025
198d769
move helper out of the POST body
Sep 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .cursor/rules/overview.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ This is the technical documentation for the Agentuity Cloud, which covers:
- Examples, tutorials, samples (/content/Examples)
- And the different SDKs (/content/SDKs)

This doc app is a NextJS app built on top of Fumadocs (https://fumadocs.vercel.app/docs/ui).
This doc app is a NextJS app built on top of Fumadocs (https://fumadocs.vercel.app/docs/ui).

This project also contains the agent the powers RAG and Tutorials. Those agents live in `/agent-docs` directory.
To run the agent server locally, go into that directory with `cd agent-docs` and then start the agent with `agentuity dev`.
To run the NextJS app, do `npm run dev` in the root of this repository. You will want to start these two apps in separate repositories.
69 changes: 69 additions & 0 deletions .cursor/rules/tutorials-structure.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
### Rule: tutorials-structure

Purpose: Define how tutorials are authored and rendered so docs and runnable code stay in sync.

### Structure
- Narrative pages: `content/Tutorial/<tutorial-id>/step-<n>.mdx`
- Section navigation: `content/Tutorial/meta.json` (list MDX page slugs in order)
- Runnable example project: `examples/<tutorial-id>/` (full project; exclude `node_modules/`, `.uv/`)
- Tutorial code snippets: must be imported from files via `<CodeFromFiles />`
- Other, non-project examples: use regular fenced code blocks in MDX

### MDX authoring
- Each step MDX must use frontmatter:
- `title`, `description` (recommended: `stepNumber`, `next`, `prev`)
- Import real code from the example project using repo-root-relative paths via `<CodeFromFiles />`:

```mdx
---
title: Step 1 — Getting Started
description: Intro step
---

<!-- Single snippet -->
<CodeFromFiles snippets={[{ path: "/examples/javascript-sdk/src/agent.ts", lang: "ts", title: "agent.ts" }]} />

<!-- Line range -->
<CodeFromFiles snippets={[{ path: "/examples/javascript-sdk/src/agent.ts", lang: "ts", from: 12, to: 48, title: "Handler section" }]} />

<!-- Multi-language tabs -->
<CodeFromFiles snippets={[
{ path: "/examples/javascript-sdk/src/agent.ts", lang: "ts", title: "TypeScript" },
{ path: "/examples/javascript-sdk-python/src/agent.py", lang: "python", title: "Python" },
]} title="Agent comparison" />
```

### `<CodeFromFiles />` component
- Available in MDX via the docs page components map
- Props:
- `snippets`: array of `{ path, lang?, from?, to?, title? }`
- `path`: repo-root-relative (must start with `/`), validated and read server-side
- `lang`: language for highlighting (auto-inferred if omitted)
- `from`, `to`: 1-based line range (inclusive)
- `title`: label per tab
- `title` (optional): heading displayed above the tabs
- Renders using shared `CodeBlock` styling and `Tabs` for multiple snippets

### Example project conventions (`examples/<tutorial-id>/`)
- Include: `package.json`, `tsconfig.json`, `src/**`, optional `README.md`, optional lockfile
- Exclude: `node_modules/`
- Optional hygiene:
- Add `examples/**` to `.eslintignore` if you don’t want repo-wide linting on example sources
- Add `examples/**` to root `tsconfig.json` `exclude` if you don’t want repo-wide type-checks
- Should be runnable in a sandbox (StackBlitz/CodeSandbox) via `package.json` scripts

### Rendering pipeline
- Fumadocs loads MDX via `lib/source.ts` and `app/(docs)/[[...slug]]/page.tsx`
- `<CodeFromFiles />` reads files at build/server time and renders with `CodeBlock`


### Agent compatibility (optional)
- Step API: `GET /api/tutorials/:id/steps/:stepNumber` returns `{ mdx, snippets }`.
- The chat UI replaces each `<CodeFromFiles />` occurrence with one or more fenced code blocks by consuming entries from `snippets` in order.

### Quality gates (recommended)
- CI verifies:
- All `content/Tutorial/**.mdx` pages referenced by `content/Tutorial/meta.json` build without errors
- All `<CodeFromFiles snippets={[...]}/>` references resolve to existing files
- Optional: the example project type-checks (`tsc --noEmit`) or passes a smoke test

7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Agent Configuration
AGENT_BASE_URL=http://127.0.0.1:3500
AGENT_ID=agent_9ccc5545e93644bd9d7954e632a55a61
AGENT_QA_ID=agent_9ccc5545e93644bd9d7954e632a55a61
AGENT_PULSE_ID=agent_ddcb59aa4473f1323be5d9f5fb62b74e

# Alternative: You can also set the full URL instead of BASE_URL + ID
# AGENT_FULL_URL=http://127.0.0.1:3500/agent_9ccc5545e93644bd9d7954e632a55a61
# API key can be found in agent-docs .env AGENTUITY_SDK_KEY
AGENTUITY_API_KEY=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ yarn-error.log*
.env*.local
.env.local
.env.production
.env
.vercel
next-env.d.ts
.open-next
Expand Down
3 changes: 3 additions & 0 deletions agent-docs/agentuity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ agents:
- id: agent_9ccc5545e93644bd9d7954e632a55a61
name: doc-qa
description: Agent that can answer questions based on dev docs as the knowledge base
- id: agent_ddcb59aa4473f1323be5d9f5fb62b74e
name: agent-pulse
description: Agentuity web app agent that converses with users for generate conversation and structured docs tutorials.
2 changes: 1 addition & 1 deletion agent-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
}
},
"module": "index.ts"
}
}
Comment on lines 42 to +43
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Fix incorrect "module" entry; prefer proper ESM/CJS exports over pointing to TypeScript source

"module": "index.ts" points to TS source, which many bundlers/loaders won’t resolve. Since this package is "type": "module" and private, either remove "module" or publish built artifacts and use an "exports" map (plus "types" if needed).

Example exports map (adjust paths to your actual build output):
{
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
}
}

Also verify "main": "index.js" actually exists at runtime (build/bundle produces it) to avoid resolution failures.


🏁 Script executed:

#!/bin/bash
set -e
# Locate package.json for agent-docs
PKG=$(find . -type f -path '*agent-docs/package.json' | head -n1)
echo "Using package.json at $PKG"
sed -n '1,200p' "$PKG"

# Locate tsconfig.json for agent-docs
TSCFG=$(find . -type f -path '*agent-docs/tsconfig.json' | head -n1)
echo "tsconfig.json at $TSCFG"
sed -n '1,200p' "$TSCFG"

# Check for dist directory in agent-docs
echo "Checking for dist directory in agent-docs"
find "$(dirname "$PKG")" -maxdepth 2 -type d -name 'dist'

# List index.ts and index.js files in agent-docs
echo "Listing index files in agent-docs"
find "$(dirname "$PKG")" -maxdepth 2 -type f \( -name 'index.ts' -o -name 'index.js' \)

Length of output: 2299


Remove the incorrect "module" entry and configure proper exports
In agent-docs/package.json, delete "module": "index.ts" and add an "exports" map that points to your built ESM, CJS, and type artifacts (e.g. .agentuity/index.mjs, .agentuity/index.cjs, .agentuity/index.d.ts). Also ensure that "main": "index.js" matches an actual output file at runtime.

🤖 Prompt for AI Agents
In agent-docs/package.json around lines 42 to 43, remove the incorrect "module":
"index.ts" entry and replace it with an "exports" map that points to the package
build outputs for ESM, CJS and types (for example the built paths under
.agentuity like .agentuity/index.mjs, .agentuity/index.cjs and
.agentuity/index.d.ts), and ensure "main": "index.js" references an actual
runtime output file (or update "main" to the correct built CJS file). Update or
add "types" to point to the built d.ts file and verify the package build step
produces the referenced files.

102 changes: 102 additions & 0 deletions agent-docs/src/agents/agent-pulse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Pulse Agent

A conversational AI agent for tutorial management built with OpenAI and structured responses.

## Overview

Pulse is a friendly AI assistant that helps users discover, start, and navigate through tutorials. It uses OpenAI's GPT-4o-mini with structured response generation to provide both conversational responses and actionable instructions.

## Architecture

### Core Components

- **`index.ts`**: Main agent logic using `generateObject` for structured responses
- **`chat-helpers.ts`**: Conversation history management
- **`tutorial-helpers.ts`**: Tutorial content fetching and formatting
- **`tutorial.ts`**: Tutorial API integration

Comment on lines +13 to +17
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Doc/file name mismatch: verify and align component list.

The README references chat-helpers.ts and tutorial-helpers.ts, but the PR appears to use context/builder.ts, request/parser.ts, state/*, etc. Please sync names/paths to avoid confusion.

Run to verify and list actual files:


🏁 Script executed:

#!/bin/bash
fd -a --type f 'agent-pulse' | sort

Length of output: 35


🏁 Script executed:

#!/bin/bash
# List all files in the agent-pulse agent directory to verify actual filenames
if [ -d agent-docs/src/agents/agent-pulse ]; then
  find agent-docs/src/agents/agent-pulse -type f | sort
else
  echo "Directory agent-docs/src/agents/agent-pulse not found"
fi

Length of output: 681


Align README.md component list with actual agent-pulse files
Remove the nonexistent chat-helpers.ts and tutorial-helpers.ts entries in agent-docs/src/agents/agent-pulse/README.md (lines 13–17) and replace them with the real files under that directory:

  • context/builder.ts
  • request/parser.ts, request/types.ts
  • state.ts, state/manager.ts
  • streaming/processor.ts, streaming/types.ts
  • tools.ts
  • types.ts
    (keep index.ts and tutorial.ts as is)
🧰 Tools
🪛 LanguageTool

[grammar] ~13-~13: There might be a mistake here.
Context: ...generateObject for structured responses - **chat-helpers.ts**: Conversation history management - **t...

(QB_NEW_EN)


[grammar] ~14-~14: There might be a mistake here.
Context: ...s.ts**: Conversation history management - **tutorial-helpers.ts`**: Tutorial content fetching and formatti...

(QB_NEW_EN)


[grammar] ~15-~15: There might be a mistake here.
Context: ...Tutorial content fetching and formatting - tutorial.ts: Tutorial API integration ### Response...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In agent-docs/src/agents/agent-pulse/README.md around lines 13 to 17, the
component list is inaccurate: remove the nonexistent entries chat-helpers.ts and
tutorial-helpers.ts and replace them with the actual files present in the
agent-pulse directory. Update the list to include index.ts and tutorial.ts (keep
these), and add context/builder.ts; request/parser.ts and request/types.ts;
state.ts and state/manager.ts; streaming/processor.ts and streaming/types.ts;
tools.ts; and types.ts so the README reflects the real file structure.

### Response Structure

The agent uses `generateObject` to return structured responses with two parts:

```typescript
{
message: string, // Conversational response for the user
actionable?: { // Optional action for the program to execute
type: 'start_tutorial' | 'next_step' | 'previous_step' | 'get_tutorials' | 'none',
tutorialId?: string,
step?: number
}
}
```

### How It Works

1. **User Input**: Agent receives user message and conversation history
2. **LLM Processing**: OpenAI generates structured response with message and optional actionable object
3. **Action Execution**: Program intercepts actionable objects and executes them:
- `get_tutorials`: Fetches available tutorial list
- `start_tutorial`: Fetches real tutorial content from API
- `next_step`/`previous_step`: Navigate through tutorial steps (TODO)
4. **Response**: Returns conversational message plus any additional data (tutorial content, tutorial list, etc.)

## Key Features

- **Structured Responses**: Clean separation between conversation and actions
- **Real Tutorial Content**: No hallucinated content - all tutorial data comes from actual APIs
- **Context Awareness**: Maintains conversation history for natural references
- **Extensible Actions**: Easy to add new action types (next step, hints, etc.)
- **Debug Logging**: Comprehensive logging for troubleshooting

## Example Interactions

### Starting a Tutorial
**User**: "I want to learn the JavaScript SDK"

**LLM Response**:
```json
{
"message": "I'd be happy to help you start the JavaScript SDK tutorial!",
"actionable": {
"type": "start_tutorial",
"tutorialId": "javascript-sdk"
}
}
```

**Final Response**:
```json
{
"response": "I'd be happy to help you start the JavaScript SDK tutorial!",
"tutorialData": {
"type": "tutorial_step",
"tutorialId": "javascript-sdk",
"tutorialTitle": "JavaScript SDK Tutorial",
"currentStep": 1,
"stepContent": "Welcome to the JavaScript SDK tutorial...",
"codeBlock": {...}
},
"conversationHistory": [...]
}
```

### General Conversation
**User**: "What's the difference between TypeScript and JavaScript?"

**LLM Response**:
```json
{
"message": "TypeScript is a superset of JavaScript that adds static type checking...",
"actionable": {
"type": "none"
}
}
```

## Benefits

- **Reliable**: No parsing or tool interception needed
- **Extensible**: Easy to add new action types
- **Clean**: Clear separation between conversation and actions
- **Debuggable**: Can see exactly what the LLM wants to do
- **No Hallucination**: Tutorial content comes from real APIs, not LLM generation
54 changes: 54 additions & 0 deletions agent-docs/src/agents/agent-pulse/context/builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import type { AgentContext } from "@agentuity/sdk";

export async function buildSystemPrompt(tutorialContext: string, ctx: AgentContext): Promise<string> {
try {
const systemPrompt = `=== ROLE ===
You are Pulse, an AI assistant designed to help developers learn and navigate the Agentuity platform through interactive tutorials and clear guidance. Your primary goal is to assist users with understanding and using the Agentuity SDK effectively. When a user's query is vague, unclear, or lacks specific intent, subtly suggest relevant interactive tutorial to guide them toward learning the platform. For clear, specific questions related to the Agentuity SDK or other topics, provide direct, accurate, and concise answers without mentioning tutorials unless relevant. Always maintain a friendly and approachable tone to encourage engagement.
Your role is to ensure user have a smooth tutorial experience!
When user is asking to move to the next tutorial, simply increment the step for them.
=== PERSONALITY ===
- Friendly and encouraging with light humour
- Patient with learners at all levels
- Clear and concise in explanations
- Enthusiastic about teaching and problem-solving
=== Available Tools or Functions ===
You have access to various tools you can use -- use when appropriate!
1. Tutorial management
- startTutorialAtStep: Starting the user off at a specific step of a tutorial.
2. General assistance
- askDocsAgentTool: retrieve Agentuity documentation snippets
=== TOOL-USAGE RULES (must follow) ===
- startTutorialById must only be used when user select a tutorial. If the user starts a new tutorial, the step number should be set to one. Valid step is between 1 and totalSteps of the specific tutorial.
- Treat askDocsAgentTool as a search helper; ignore results you judge irrelevant.
=== RESPONSE STYLE (format guidelines) ===
- Begin with a short answer, then elaborate if necessary.
- Add brief comments to complex code; skip obvious lines.
- End with a question when further clarification could help the user.
=== SAFETY & BOUNDARIES ===
- If asked for private data or secrets, refuse.
- If the user requests actions outside your capabilities, apologise and explain.
- Keep every response < 400 words
Generate a response to the user query accordingly and try to be helpful
=== CONTEXT ===
${tutorialContext}
=== END OF PROMPT ===
Stream your reasoning steps clearly.`;

ctx.logger.debug("Built system prompt with tutorial context");
return systemPrompt;
} catch (error) {
ctx.logger.error("Failed to build system prompt: %s", error instanceof Error ? error.message : String(error));
throw error; // Re-throw for centralized handling
}
}
Loading