Skip to main content

Finance Team Agent

The finance team agent handles budget planning, cost analysis, financial forecasting, and expense optimization. It turns numeric data into insight and supports management decision-making.

Building the Finance Agentโ€‹

// src/agents/finance.ts
import { query } from "@anthropic-ai/claude-agent-sdk";
import { AgentResponse } from "../shared/types";
import { extractText, log } from "../shared/utils";

const FINANCE_SYSTEM_PROMPT = `You are a CFO-level financial analyst.
You analyze data accurately and deliver clear financial insight.
Every analysis states its supporting data and assumptions.
You assess risk conservatively and provide scenario-by-scenario analysis.
You treat financial data as strictly confidential.`;

export async function runFinanceAgent(task: string): Promise<AgentResponse> {
log("FINANCE", `Starting task: ${task.slice(0, 40)}...`);

const response = await query({
prompt: `${FINANCE_SYSTEM_PROMPT}\n\n---\n\n${task}`,
options: {
maxTurns: 8,
tools: ["Read", "Bash"]
}
});

const result = extractText(response);
log("FINANCE", "Task complete");

return {
department: "finance",
result,
confidence: "medium", // Financial analysis should always get expert review
actionItems: [],
escalationNeeded: result.includes("anomaly") ||
result.includes("over budget")
};
}

Key Finance Workflowsโ€‹

1. Monthly Expense Report Analysisโ€‹

> Finance team: Analyze March spending by department and flag any anomalies.

Example agent response:

## March Spending Analysis Report

### Executive Summary
- Total spend: KRW 234M (+8.2% vs. budget)
- Over-budget departments: Marketing (+23%), Engineering (+11%)
- Under-budget departments: HR (-5%), Operations (-2%)

### Anomalies
๐Ÿšจ Marketing ad spend 23% over
- Likely cause: Concentrated Q1 launch campaign
- Recommendation: Re-review Q2 budget allocation

### Cost Optimization Opportunities
1. 3 unused SaaS subscriptions (potential savings of KRW 1.8M/month)
2. Cloud cost right-sizing for up to 15% savings

2. Building a Budget Planโ€‹

async function createBudgetPlan(
annualRevenue: number,
growthTarget: number,
departments: string[]
) {
return runFinanceAgent(
`Build an annual budget plan.

Baseline information:
- Prior-year revenue: KRW ${annualRevenue.toLocaleString()}
- Growth target: ${growthTarget}%
- Departments to allocate: ${departments.join(", ")}

Deliverables:
1. Per-department budget allocation (percentage and amount)
2. Quarterly execution plan
3. Key investment priorities (by ROI)
4. Savings targets and approaches
5. Risk scenarios (optimistic / base / conservative)`
);
}

3. Investment Return Analysis (ROI)โ€‹

async function analyzeROI(
investmentName: string,
cost: number,
expectedBenefits: string
) {
return runFinanceAgent(
`Analyze the ROI of the following investment.

Investment name: ${investmentName}
Total investment cost: KRW ${cost.toLocaleString()}

Expected benefits:
${expectedBenefits}

Analysis requested:
- Break-even point (BEP) calculation
- 3-year / 5-year ROI scenarios
- NPV (net present value) calculation (10% discount rate)
- Risk factors and sensitivity analysis
- Final investment recommendation (proceed / hold / conditional proceed)`
);
}

4. Cash Flow Forecastโ€‹

async function cashFlowForecast(
currentData: string,
forecastMonths: number
) {
return runFinanceAgent(
`Based on the current financial data, forecast cash flow for ${forecastMonths} months.

Current data:
${currentData}

Include in the forecast:
- Monthly projected income/expenses
- Cash balance trend
- Cash-shortage risk windows
- Options for deploying surplus cash
- Whether short-term funding is needed`
);
}

AI-Driven Cost Savings Automationโ€‹

// Cost optimization script that runs automatically on the 1st of each month
async function monthlyExpenseOptimization() {
const report = await runFinanceAgent(
`Analyze this month's cost data and find savings that can be implemented immediately.

Review areas:
1. SaaS subscriptions - identify unused/duplicate
2. Cloud infrastructure - inefficient resources
3. External contracts - items open to renegotiation
4. Operating expenses - tasks that can be automated

For each item: include current cost, potential savings, and implementation difficulty`
);

// Notify the CFO if savings of 10% or more are possible
if (report.result.includes("10%") || report.result.includes("10M")) {
await notifyCFO(report.result);
}

return report;
}
Cautions for using the finance agent
  • AI analysis is for reference only; final financial decisions require CFO / finance lead approval
  • Confirm the sensitivity level before processing real financial data
  • Judgments involving tax, depreciation, and accounting standards require review by an accountant