text
stringlengths
0
59.1k
- Summary (1-2 sentences)
- Priority (High | Medium | Low)
- Status (New | In Progress | Blocked | Done)
- Next steps (short bullet list as a single string)`);
});
}),
});
```
</ExpandableCode>
:::info
Your Airtable table must include columns named `Summary`, `Priority`, `Status`, and `Next steps`. Adjust the prompt if your schema differs.
:::
</StepSection>
<StepSection stepNumber={6} title="Add the Airtable Action and Update Tool">
<video controls loop muted playsInline style={{width: '100%', height: 'auto'}}>
<source src="https://cdn.voltagent.dev/voltagent-recipes-guides/airtable-4.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<br/>
<br/>
Open [VoltAgent Console](https://console.voltagent.dev/actions) and go to **Actions** → **Create Action**.
1. Select **Airtable** and the same credential
2. Select **Update record**, base, and table
3. Save the action
Add the VoltOps client and `updateAirtableRecord` tool to your code:
<ExpandableCode title="src/index.ts" previewLines={15}>
```ts
import { openai } from "@ai-sdk/openai";
import { Agent, VoltAgent, createTool, createTriggers } from "@voltagent/core";
import { VoltOpsClient } from "@voltagent/sdk";
import { createPinoLogger } from "@voltagent/logger";
import { honoServer } from "@voltagent/server-hono";
import { safeStringify } from "@voltagent/internal";
import { z } from "zod";
type AirtableRecordCreatedPayload = {
record?: {
id?: string;
fields?: Record<string, unknown>;
};
baseId?: string;
tableId?: string;
};
const logger = createPinoLogger({ name: "with-airtable", level: "info" });
const voltOps = new VoltOpsClient({
publicKey: process.env.VOLTAGENT_PUBLIC_KEY ?? "",
secretKey: process.env.VOLTAGENT_SECRET_KEY ?? "",
});
const updateAirtableRecord = createTool({
name: "updateAirtableRecord",
description: "Update an Airtable record with summary/priority/status/next steps.",
parameters: z.object({
recordId: z.string(),
fields: z.record(z.unknown()),
baseId: z.string().optional(),
tableId: z.string().optional(),
}),
execute: async ({ recordId, fields, baseId, tableId }) => {
const credentialId = process.env.AIRTABLE_CREDENTIAL_ID;
if (!credentialId) {
throw new Error("AIRTABLE_CREDENTIAL_ID is not set");
}
return voltOps.actions.airtable.updateRecord({
credential: { credentialId },
baseId: baseId,
tableId: tableId,
recordId,
fields,
});
},
});
const airtableAgent = new Agent({
name: "airtable-agent",
instructions: `You process newly created Airtable rows.
Create a short summary, assign a priority (High/Medium/Low), pick a status (New/In Progress/Blocked/Done), and list next steps.
Always write updates via updateAirtableRecord using the exact Airtable field names.`,
tools: [updateAirtableRecord],
model: openai("gpt-4o-mini"),
});
new VoltAgent({
agents: { airtableAgent },
server: honoServer(),