andibase

Weekly Report Email Agent

Agent-ready recipe for creating a weekly reporting agent that tracks email delivery status in andibase

Open Markdown

This recipe tells an agent exactly how to build a weekly reporting workflow in andibase.

Goal

Create three things in one workspace:

  1. A weekly-report data definition.
  2. A weekly-report-delivery data definition.
  3. One agent that creates weekly reports and tracks whether email delivery is complete or still pending.

Expected outcome

After following this recipe, the workspace should have:

  • a weekly-report definition for generated report content
  • a weekly-report-delivery definition for email recipients and delivery state
  • a weekly-report-agent agent

Use the API documented in:

Current runtime constraint

The current workspace agent runtime exposes data tools, not a direct email-sending tool.

That means this recipe should:

  • generate the weekly report
  • save the report in workspace data
  • create delivery rows for each recipient
  • mark email delivery as pending when direct email sending is not available

If a future integration, automation, or external system handles email delivery, it can read the pending delivery rows and complete them later.

Agent instructions

When an agent executes this recipe, it should follow these rules:

  1. Create the weekly-report definition first.
  2. Create the weekly-report-delivery definition second.
  3. In the current API, data definition handles are generated from name. Use name: "Weekly Report" and name: "Weekly Report Delivery" so the created handles normalize to weekly-report and weekly-report-delivery.
  4. If your execution environment can resolve the created weekly-report definition id, wire the delivery-to-report link as a relationship field. If it cannot, use a text foreign key such as reportRecordId instead, because the public HTTP API still expects dataDefinitionId for relationship fields.
  5. Create the weekly-report agent with instructions focused on report generation, persistence, and delivery tracking.
  6. Use the current agent tools. Do not claim an email was sent unless the execution environment actually sent it.
  7. If email sending is not available, create or update delivery rows with a pending status and a clear pending reason.
  8. Ask the user only when a missing choice materially changes the report, such as recipient list, reporting period, or source data scope.

Step 1: Create the data model

Create two data definitions: weekly-report and weekly-report-delivery.

1. Weekly Report definition

Use name: "Weekly Report". The current API derives the handle from the name, so this will create the weekly-report handle.

Recommended fields:

{
  "name": "Weekly Report",
  "description": "Stores generated weekly summaries and their operational status.",
  "fields": {
    "title": {
      "name": "Title",
      "type": "text"
    },
    "periodStart": {
      "name": "Period start",
      "type": "date"
    },
    "periodEnd": {
      "name": "Period end",
      "type": "date"
    },
    "generatedAt": {
      "name": "Generated at",
      "type": "timestamp"
    },
    "status": {
      "name": "Status",
      "type": "select",
      "options": [
        { "value": "draft", "label": "Draft", "color": "zinc" },
        { "value": "generated", "label": "Generated", "color": "blue" },
        { "value": "pending-delivery", "label": "Pending delivery", "color": "amber" },
        { "value": "delivered", "label": "Delivered", "color": "green" }
      ]
    },
    "summary": {
      "name": "Summary",
      "type": "text",
      "variant": "long-text"
    },
    "highlights": {
      "name": "Highlights",
      "type": "json"
    },
    "blockers": {
      "name": "Blockers",
      "type": "json"
    },
    "metrics": {
      "name": "Metrics",
      "type": "json"
    },
    "reportMarkdown": {
      "name": "Report markdown",
      "type": "text",
      "variant": "long-text"
    },
    "sourceNotes": {
      "name": "Source notes",
      "type": "text",
      "variant": "long-text"
    },
    "pendingItems": {
      "name": "Pending items",
      "type": "json"
    }
  }
}

Recommended defaults for agent-created report rows:

  • status: generated
  • generatedAt: now
  • highlights: []
  • blockers: []
  • metrics: {}
  • pendingItems: []

2. Weekly Report Delivery definition

Use name: "Weekly Report Delivery". The current API derives the handle from the name, so this will create the weekly-report-delivery handle.

Recommended fields:

{
  "name": "Weekly Report Delivery",
  "description": "Tracks intended recipients and whether delivery is done or still pending.",
  "fields": {
    "reportRecordId": {
      "name": "Report record id",
      "description": "Store the linked weekly-report row id when the client only has public HTTP API access.",
      "type": "text"
    },
    "recipientName": {
      "name": "Recipient name",
      "type": "text"
    },
    "recipientEmail": {
      "name": "Recipient email",
      "type": "text"
    },
    "channel": {
      "name": "Channel",
      "type": "select",
      "options": [
        { "value": "email", "label": "Email", "color": "blue" },
        { "value": "other", "label": "Other", "color": "zinc" }
      ]
    },
    "subject": {
      "name": "Subject",
      "type": "text"
    },
    "deliveryStatus": {
      "name": "Delivery status",
      "type": "select",
      "options": [
        { "value": "pending", "label": "Pending", "color": "amber" },
        { "value": "sent", "label": "Sent", "color": "green" },
        { "value": "blocked", "label": "Blocked", "color": "red" },
        { "value": "skipped", "label": "Skipped", "color": "zinc" }
      ]
    },
    "lastAttemptAt": {
      "name": "Last attempt at",
      "type": "timestamp"
    },
    "sentAt": {
      "name": "Sent at",
      "type": "timestamp"
    },
    "pendingReason": {
      "name": "Pending reason",
      "type": "text",
      "variant": "long-text"
    },
    "deliveryNotes": {
      "name": "Delivery notes",
      "type": "text",
      "variant": "long-text"
    }
  }
}

If your client already has the created weekly-report definition id, you can replace reportRecordId with:

{
  "reportId": {
    "name": "Report",
    "type": "relationship",
    "dataDefinitionId": "<weekly-report-definition-id>"
  }
}

3. Example create requests

Create the definitions with POST /api/v1/data-definitions.

Current API note:

  • the create payload uses name, description, and fields
  • the handle is derived from name
  • data rows are created with data, not attributes

Example for weekly-report:

curl -X POST "https://andibase.com/api/v1/data-definitions" \
  -H "Authorization: Bearer $ANDI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Weekly Report",
    "description": "Stores generated weekly summaries and their operational status.",
    "fields": {
      "title": { "name": "Title", "type": "text" },
      "periodStart": { "name": "Period start", "type": "date" },
      "periodEnd": { "name": "Period end", "type": "date" },
      "generatedAt": { "name": "Generated at", "type": "timestamp" },
      "status": {
        "name": "Status",
        "type": "select",
        "options": [
          { "value": "generated", "label": "Generated", "color": "blue" },
          { "value": "pending-delivery", "label": "Pending delivery", "color": "amber" },
          { "value": "delivered", "label": "Delivered", "color": "green" }
        ]
      },
      "summary": { "name": "Summary", "type": "text", "variant": "long-text" },
      "reportMarkdown": { "name": "Report markdown", "type": "text", "variant": "long-text" },
      "pendingItems": { "name": "Pending items", "type": "json" }
    }
  }'

Create sample report rows with POST /api/v1/data-definitions/weekly-report/data/upsert-many.

curl -X POST "https://andibase.com/api/v1/data-definitions/weekly-report/data/upsert-many" \
  -H "Authorization: Bearer $ANDI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "data": {
          "title": "Weekly operations report · 2026-03-16 to 2026-03-20",
          "periodStart": "2026-03-16",
          "periodEnd": "2026-03-20",
          "generatedAt": "2026-03-20T18:00:00.000Z",
          "status": "pending-delivery",
          "summary": "Closed 18 tasks, 3 remain blocked, and response time improved week over week.",
          "highlights": ["Closed 18 tasks", "Response time improved"],
          "blockers": ["Awaiting vendor approval", "Two customer escalations still open"],
          "metrics": { "closedTasks": 18, "openEscalations": 2 },
          "reportMarkdown": "# Weekly report\n\n- Closed 18 tasks\n- 3 blockers remain\n",
          "pendingItems": ["Email delivery still pending"]
        }
      }
    ]
  }'

Step 2: Create the weekly report agent

Create one workspace agent with handle weekly-report-agent.

Recommended behavior:

  • gather facts from the workspace using the current data tools
  • generate a concise weekly report in structured fields plus markdown
  • create one report row for the requested week
  • create one delivery row per intended recipient
  • mark delivery as pending when direct email sending is not available
  • mark the report itself as pending-delivery when any recipient is still pending
  • if delivery later becomes possible in the execution environment, update the relevant delivery rows to sent and the report to delivered

Recommended agent payload:

{
  "name": "Weekly Report Agent",
  "handle": "weekly-report-agent",
  "description": "Creates weekly reports and tracks whether email delivery is complete or still pending.",
  "model": "openai/gpt-5.4",
  "capabilities": {
    "webAccess": false,
    "browserAccess": false,
    "objectsAccess": true
  },
  "instructions": "You manage a weekly reporting workflow. Use the weekly-report and weekly-report-delivery data definitions as the source of truth. Be action-oriented: make reasonable assumptions, complete the work when the intended outcome is clear, and avoid asking for confirmation on every small step. Use the current workspace data tools to gather facts, create a weekly report row, and create one delivery row per recipient. Do not claim that an email was sent unless the execution environment actually sent it. When direct email sending is not available, set deliveryStatus to pending, explain the pending reason clearly, and include the pending action in the report pendingItems field. If all deliveries are still pending, set the report status to pending-delivery. If all deliveries are completed, set the report status to delivered."
}

Create the agent with POST /api/v1/agents.

Step 3: Expected operating flow

When a user asks for a weekly report, the agent should:

  1. Resolve the reporting period.
  2. Query the available workspace data needed for the report.
  3. Generate summary content, highlights, blockers, metrics, and markdown.
  4. Create a weekly-report row.
  5. Create one weekly-report-delivery row per recipient.
  6. If direct email sending is unavailable, mark each delivery row as pending and explain why.
  7. Update the report status to pending-delivery when any delivery is still pending.

An agent should consider the recipe complete only if all of the following are true:

  1. weekly-report exists and includes the required fields.
  2. weekly-report-delivery exists and includes either the reportId relationship or the reportRecordId fallback used by the current public HTTP API flow.
  3. weekly-report-agent exists.
  4. At least one sample weekly-report row can be created successfully.
  5. At least one sample weekly-report-delivery row can be created successfully.
  6. The recipe makes it explicit when email delivery is pending instead of silently pretending delivery succeeded.

Minimal delivery summary

When the agent finishes, it should report:

  • the created data definition handles
  • the created agent handle
  • whether email was actually sent or is still pending
  • the pending reason for any blocked delivery
  • any assumptions made for reporting period, recipients, or source data scope

On this page