Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 46 additions & 6 deletions engage-box/roi_reporting/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ Two report types are supported:

## Prerequisites

### Data Preparation

Before using this agent, you need to prepare the required database tables. The `roi_reporting` workflow in the treasure-boxes repository provides a reference implementation for creating these tables.

### Required Database Tables

The agent requires the following tables in the `engage_roi_reporting` database:

| Table | Description | Key Columns |
|---|---|---|
| `daily_summary` | Daily aggregated performance metrics | `summary_date`, `campaign_id`, `journey_id`, `total_sends`, `total_deliveries`, `total_opens`, `total_clicks`, `total_conversions`, `total_revenue_direct`, `total_revenue_contributed` |
| `event_master` | Campaign/journey metadata | `campaign_id`, `journey_id`, `campaign_name`, `journey_name` |
| `events_master` | Campaign/journey metadata | `campaign_id`, `journey_id`, `campaign_name`, `journey_name` |
| `email_events` | Email event logs | `event_timestamp`, `event_type`, `message_id`, `campaign_id`, `journey_id`, `email_title` |
| `revenue` | Revenue attribution data | `conversion_timestamp`, `conversion_id`, `campaign_id`, `total_revenue`, `attribution_type` |
| `revenue_table` | Revenue attribution data | `conversion_timestamp`, `conversion_id`, `campaign_id`, `total_revenue`, `attribution_type` |
Comment on lines 45 to +48
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The Required Database Tables section was updated to events_master / revenue_table, but this README still references the old revenue naming elsewhere (e.g., the later schema subsection title 'revenue table:' and the manual setup note about databases containing “revenue tables”). Please update the remaining references in this README to consistently use revenue_table (and, if applicable, events_master) so users don’t set up the wrong schema.

Copilot uses AI. Check for mistakes.

### Data Schema Requirements

Expand All @@ -63,17 +69,51 @@ Two report types are supported:

## Setup Instructions

### Option A: CLI (Recommended)
**IMPORTANT**: The `tdx agent push` command currently creates ONLY the agent resource itself. Knowledge Bases, Tools, Outputs, and Form Interfaces must be configured separately via LLM API or the AI Agent Foundry UI.

### Option A: LLM API Setup (Recommended for Complete Setup)

For a fully automated setup including all components, use the LLM API approach:

**Step 1: Create Project**
```bash
tdx llm project create "ROI Reporting Agent"
```

**Step 2-6: Use LLM API**

Use Python scripts to create the agent and all resources via LLM API. This ensures:
- ✅ Agent core attributes (name, model, system prompt)
Comment on lines +83 to +86
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The “Step 2-6: Use LLM API” section doesn’t actually enumerate steps 2–6 or point to specific script filenames/commands to run, which makes the setup flow hard to follow. Please either list the concrete steps (with inputs/outputs to expect) or link to the exact scripts in this repo that implement each step.

Copilot uses AI. Check for mistakes.
- ✅ Knowledge Bases (Text KBs and Database KB)
- ✅ Tools and Outputs configuration
- ✅ Form Interfaces

Reference implementation: See the `/llm-api-setup` skill documentation for complete workflow and Python script templates.

Comment on lines +89 to +92
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The reference to “/llm-api-setup skill documentation” isn’t resolvable within this repository (no matching docs found), so readers won’t know where to go next. Please replace this with a concrete link/path that exists in-repo (or an explicit external URL), or add the referenced documentation to the repo.

Copilot uses AI. Check for mistakes.
**Key points:**
- Use `POST /api/agents` to create the agent with core attributes
- Use `POST /api/text_knowledge_bases` for Text KBs
- Use `POST /api/knowledge_bases` for Database KB
- Use `PATCH /api/agents/{id}` to configure tools and outputs
- Use `POST /api/form_interfaces` for form interfaces
- Verify all components after setup

### Option B: CLI + Manual Configuration (Partial Automation)

```bash
# 1. Clone or download this directory
# 2. Edit tools.yml and replace <DATABASE_NAME> with your actual database name
# 3. Run:
# 3. Create project and agent:
tdx llm project create "ROI Reporting Agent"
tdx agent push . -f
```

### Option B: Manual (AI Agent Foundry UI)
**Note**: `tdx agent push` creates only the agent itself. You must manually configure:
- Knowledge Bases (via UI or LLM API)
- Tools and Outputs (via LLM API)
- Form Interfaces (via LLM API)

### Option C: Manual (AI Agent Foundry UI)

#### 1. Create Project
Create a new project named **`ROI Reporting Agent`** in AI Agent Foundry.
Expand All @@ -93,7 +133,7 @@ Create a new project named **`ROI Reporting Agent`** in AI Agent Foundry.
- Content: paste from `knowledge_base_campaign_details.md`

#### 4. Create Agent
- Name: **`TD-Managed: Dashboard Viz`**
- Name: **`Dashboard Viz`**
- System Prompt: paste from `system_prompt.md`
- Model: Claude 4.5 Sonnet
- Max tool iterations: 4
Expand Down
2 changes: 1 addition & 1 deletion engage-box/roi_reporting/agent/agent.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
llm_project: "ROI Reporting Agent"
name: "TD-Managed: Dashboard Viz"
name: "Dashboard Viz"
model: claude-4.5-sonnet
max_tool_iterations: 4
temperature: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "TD-Managed: Campaign Details"
agent: "@ref(type: \"agent\", name: \"TD-Managed: Dashboard Viz\")"
name: "Campaign Details"
agent: "@ref(type: \"agent\", name: \"Dashboard Viz\")"
prompt_template: |
Create dashboard with following conditions:
- Report_id: 2. Campaign Summary
Comment on lines +1 to 5
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The form is named “Campaign Details”, but the prompt template uses Report_id: 2. Campaign Summary. If Report_id is user-facing or used to route logic, this mismatch is confusing and can lead to selecting the wrong report type. Please align the Report_id label/value with the report’s name (or document why “Campaign Summary” is the correct identifier).

Copilot uses AI. Check for mistakes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "TD-Managed: Overall Summary"
agent: "@ref(type: \"agent\", name: \"TD-Managed: Dashboard Viz\")"
name: "Overall Summary"
agent: "@ref(type: \"agent\", name: \"Dashboard Viz\")"
prompt_template: |
Create dashboard with following conditions:
- Report_id: 1.Overall Summary
Expand Down
Loading