Weekly Report Email Agent
Agent-ready recipe for creating a weekly reporting agent that tracks email delivery status in andibase
This recipe tells an agent exactly how to build a weekly reporting workflow in andibase.
Goal
Create three things in one workspace:
- A
weekly-reportdata definition. - A
weekly-report-deliverydata definition. - 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-reportdefinition for generated report content - a
weekly-report-deliverydefinition for email recipients and delivery state - a
weekly-report-agentagent
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
pendingwhen 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:
- Create the
weekly-reportdefinition first. - Create the
weekly-report-deliverydefinition second. - In the current API, data definition handles are generated from
name. Usename: "Weekly Report"andname: "Weekly Report Delivery"so the created handles normalize toweekly-reportandweekly-report-delivery. - If your execution environment can resolve the created weekly-report definition id, wire the delivery-to-report link as a
relationshipfield. If it cannot, use a text foreign key such asreportRecordIdinstead, because the public HTTP API still expectsdataDefinitionIdfor relationship fields. - Create the weekly-report agent with instructions focused on report generation, persistence, and delivery tracking.
- Use the current agent tools. Do not claim an email was sent unless the execution environment actually sent it.
- If email sending is not available, create or update delivery rows with a pending status and a clear pending reason.
- 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:generatedgeneratedAt: nowhighlights:[]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, andfields - the handle is derived from
name - data rows are created with
data, notattributes
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
pendingwhen direct email sending is not available - mark the report itself as
pending-deliverywhen any recipient is still pending - if delivery later becomes possible in the execution environment, update the relevant delivery rows to
sentand the report todelivered
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:
- Resolve the reporting period.
- Query the available workspace data needed for the report.
- Generate summary content, highlights, blockers, metrics, and markdown.
- Create a
weekly-reportrow. - Create one
weekly-report-deliveryrow per recipient. - If direct email sending is unavailable, mark each delivery row as
pendingand explain why. - Update the report status to
pending-deliverywhen any delivery is still pending.
Recommended acceptance checks
An agent should consider the recipe complete only if all of the following are true:
weekly-reportexists and includes the required fields.weekly-report-deliveryexists and includes either thereportIdrelationship or thereportRecordIdfallback used by the current public HTTP API flow.weekly-report-agentexists.- At least one sample weekly-report row can be created successfully.
- At least one sample weekly-report-delivery row can be created successfully.
- 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