AgentUse

AI agent workflow · Finance operations tutorial

Turn monthly invoice collection into an AgentUse workflow

Make the workflow explicit, prepare its context and data contract, then give a coding agent one prompt to create the right AgentUse agent—or small agent team—for your environment.

20–30 minutesNo agent code requiredLast tested August 2026
You'll finish with: A workflow map, context pack, data contract, approval policy, and one copyable prompt that creates and tests your AgentUse setup.

1 · Services and tools

How the services work together

The outcome belongs to the complete service chain—not any one integration. Each service contributes a specific input, action, or destination and needs an explicit AgentUse connection.

ServiceType

CSV or spreadsheet

Read the monthly credit-card statement

Anthropic xlsx skill + AgentUse filesystem

Skill

Gmail

Search invoice emails, identify attachments, and retrieve their file bytes

Google Gmail MCP + narrow Gmail attachment API reader

MCP + API

Google Drive

Search existing invoices and save the final bundle

Google Drive MCP server

MCP

Vendor portals

Download invoices missing from email and Drive

Vercel agent-browser skill

Skill

Output folder

Write renamed invoices and the reconciliation report

Filesystem tool or Drive MCP

Tool
Connector rule: Resolve the exact installed skill or MCP package during setup. The names below describe the required capability, not a package that the coding agent may invent.

2 · Agent architecture

See which AgentUse agent owns each stage

The manager starts and closes the run. Work then moves through a sequential normalization, retrieval, and reconciliation pipeline so every handoff has an inspectable data contract.

agents/invoice-collection/4 agents
monthly-invoice-collectormgr
@judgment
statement
statement-normalizer
@fast
statement-normalizer
@fast
normalized transactions
invoice-finder
@judgment
invoice-finder
@judgment
candidates + evidence
invoice-reconciler
@judgment
invoice-reconciler
@judgment
bundle + exceptions
monthly-invoice-collectormgr
@judgment
data handoffmanager entry or return

This permission-separated reference architecture makes each stage independently testable. The coding agent may collapse it into one agent when the available connectors share the same permissions and execution context.

monthly-invoice-collector

manager

Own the monthly run, delegate each bounded stage, and return the finished bundle or exceptions.

@judgment
subagentsapproval boundary
Receive statement
Delegate stages
Review completeness
Return handoff

statement-normalizer

Turn the source statement into stable, testable transaction rows without changing the original.

@fast
spreadsheet skillfilesystem read
Open CSV
Map columns
Normalize vendors
Emit transaction list

invoice-finder

Search approved services and return candidate documents with source evidence for each transaction.

@judgment
Gmail MCP + attachment readerDrive MCPbrowser skill
Take transaction list
Search Gmail
Search Drive
Check portals
Return candidates

invoice-reconciler

Verify matches, classify exceptions, and create the invoice bundle and reconciliation report.

@judgment
filesystem read/writeapproval gate
Compare evidence
Deduplicate files
Classify status
Write bundle + report

3 · Map the workflow

Describe the job before choosing tools

The useful unit is the reconciled invoice bundle—not one Gmail or Drive action. Map the human process from receiving a statement through the final finance handoff.

1

Receive

Finance provides the monthly credit-card statement.

2

Normalize

Extract date, vendor, currency, amount, cardholder, and source row.

3

Search

Check approved inboxes, Drive folders, and authenticated vendor portals.

4

Verify

Match each document against the transaction evidence.

5

Deliver

Bundle verified invoices and return unresolved charges with next actions.

Definition of done: Every statement row appears exactly once in the reconciliation report, either matched with source evidence or unresolved with the searches attempted and a next action.

4 · Audit permissions

Find the real permission ceiling of every connector

Start with the connected identity and token scopes, then inspect the tools the MCP server actually exposes. Labels, folders, and prompt instructions express workflow intent; only credentials, resource ACLs, tool filtering, and runtime policy can enforce it.

Gmail MCP + attachment API reader

Partially enforced

Workflow intent

Read invoice messages under the Finance label

Credential ceiling

The connected Google identity with gmail.readonly and gmail.compose in Google's current setup guide

Exposed operations

  • Search and read messages
  • Return attachment IDs and metadata
  • Retrieve attachment bytes through users.messages.attachments.get
  • Create drafts or change labels when those MCP tools remain exposed

What is actually enforced

AgentUse can remove draft and label tools from the agent. The Finance label itself is only a search filter—not an authorization boundary—because the read token can search the connected mailbox.

Strengthen it: Use a dedicated Finance mailbox or delegated identity, keep the attachment wrapper read-only, and remove create_draft, label_*, unlabel_*, and list_drafts when the workflow does not need them.

Gmail MCP setup and scopes

Google Drive MCP

Partially enforced

Workflow intent

Read Finance invoice folders and write only to the workflow output folder

Credential ceiling

The connected Google identity with drive.readonly and drive.file; Google says the MCP server inherits that user's permissions and governance

Exposed operations

  • Search and read eligible files
  • Download file content
  • Read permissions
  • Create or copy files

What is actually enforced

Drive ACL, IRM, and Context-Aware Access are enforced. A folder named in the prompt is not a hard read boundary when the identity can read other eligible files.

Strengthen it: Share only the required folders with a dedicated identity. Remove copy_file and create_file with disallowedTools from read-only agents; give output writes to a separate worker or connection.

Drive MCP permissions

Vendor portals

Partially enforced

Workflow intent

Open approved billing domains and download invoices

Credential ceiling

The authenticated browser profile or vault entry used for each vendor

Exposed operations

  • Navigate and inspect pages
  • Click and fill forms
  • Download files
  • Run browser actions allowed by policy

What is actually enforced

agent-browser can enforce a domain allowlist and action policy in a fresh Chromium context. Its domain allowlist is incompatible with reused profiles, restored state, CDP, and auto-connect modes.

Strengthen it: Use a dedicated vendor identity and fresh browser context with allowedDomains, content boundaries, and a restrictive action policy. Treat a reused login profile as broader access.

agent-browser security

Local statement and output

Enforced

Workflow intent

Read one statement path; write renamed invoices and the report to one output directory

Credential ceiling

No external token; access is determined by the read, edit, and write paths declared in the AgentUse filesystem configuration

Exposed operations

  • Read configured paths
  • Write configured output
  • Edit configured files

What is actually enforced

AgentUse filesystem paths are containment-based. A narrow read/write configuration can mechanically limit the built-in filesystem tool to the chosen files and directories.

Strengthen it: Declare the exact statement path as read-only and grant write only to the output directory. Avoid broad project-root or parent-directory entries.

AgentUse filesystem boundaries
  • Record the exact identity and OAuth scopes granted to every connector.
  • Inspect the MCP tools list, then remove unused operations with AgentUse disallowedTools.
  • Separate a query filter such as a Gmail label from a mechanically enforced boundary.
  • Use dedicated accounts, Drive ACLs, browser profiles, and filesystem paths to narrow the real resource surface.
  • Document every remaining instruction-only assumption before the first supervised run.

5 · Prepare data

Give every input and output field a meaning

Define the normalized transaction, candidate evidence, reconciliation decision, and output handoff in one contract. A stable source row ID prevents duplicates; source IDs and rationale make every match reviewable.

FieldExampleRule
source_row_idcard-2026-07-042Required; stable ID from the source statement
transaction_date2026-07-18Required; preserve the source timezone
cardholderA. ChenRequired when the statement contains multiple cards or owners
raw_vendorFIGMA* 78420Required; preserve the statement value
normalized_vendorFigmaDerived; keep the raw value alongside it
amount15.00Required; do not round or infer
currencyUSDRequired for a verified match
candidate_document_idgmail:18f…:att-2Stable ID for each candidate; retain source-system provenance
source_urigmail://message/18f…Required for every candidate so a reviewer can reopen the source
attachment_idANGjdJ…Required for Gmail files retrieved through the attachment API
search_attemptsgmail, drive, vendor_portalRecord every source checked, including zero-result searches
match_rationaleVendor, USD 15.00, July 2026State the evidence supporting or rejecting the candidate
confidence0.96Optional score; never replace the explicit rationale
invoice_statusmatchedmatched, receipt_only, ambiguous, or missing
output_path2026-07/Figma-15.00-USD.pdfSet only after the output is written and verified
exception_ownerfinance-opsRequired for ambiguous or missing rows
Matching rule: Accept a document only when vendor, currency, amount, and billing period support the transaction. Keep receipts distinct from tax invoices.

6 · Choose approval points

Decide when the agent should ask first

Let routine collection and preparation run on their own. Ask for approval before an action changes an external system or commits you to something. Keep prohibited actions outside the workflow entirely.

Simple rule: If an action sends, shares, changes, submits, spends, or deletes, pause and ask first.
A

Runs automatically

Read the statement, search approved sources, download invoice candidates, compare evidence, rename files, and prepare the reconciliation report.

G

Ask for approval

Send email, share files, change labels or existing records, submit a portal form, or take any action that commits the user externally.

N

Never allowed

Make purchases, change billing details, delete source documents, invent matches, or place credentials in generated agent files.

Your preparation pack is ready when it contains

Workflow and definition of done

Connector permission audit

Representative input file

Input and output data contract

Matching and exception rules

Approval boundaries

7 · Create custom AgentUse agents

Create agents tailored to your monthly invoice workflow

Use your actual statement format, connected accounts, folder structure, matching rules, and review policy to shape the agents. Start manually with one representative statement; after the workflow is proven, let AgentUse handle routine collection autonomously and keep only uncertain or consequential steps for review.

First run

Supervise one real statement

Run the manager on demand, inspect its session evidence, and confirm that every transaction lands in the correct outcome class before adding a schedule.

Ongoing run

Trigger it when the statement arrives

Use AgentUse Serve to start the saved workflow from a monthly schedule or an inbound trigger after the statement is available.

Human review

Escalate exceptions, not routine work

Let reads, searches, downloads, renaming, and reporting proceed; pause ambiguous matches and consequential external actions for a person.

Recommended ownership and models. Keep the manager and workers as readable .agentuse files in the project that owns this process. Use a fast model for statement normalization and a stronger tool-capable model for matching and reconciliation; change providers later—including to a suitable open or local model—without redesigning the workflow.

Ready to build

Agent creation prompt

Copy this complete build brief into the project workspace you want the agent to update.

Create a production-ready AgentUse workflow for monthly invoice collection in my current project.

Start by checking whether this project already provides an AgentUse CLI or pins an AgentUse package version. If it does, use that project-local version through the project's existing package manager for every AgentUse command so the generated files match its runtime.

If the project does not provide AgentUse, do not modify its dependencies and do not install anything globally yet. Bootstrap the latest stable CLI without installation and load its version-matched built-in authoring guidance with:
- npx -y agentuse@latest skills get core --full
- npx -y agentuse@latest skills get creator --full
- npx -y agentuse@latest skills get tester --full

Continue using the same resolved invocation—either the project-local CLI or npx -y agentuse@latest—for models, doctor, test, session inspection, and the supervised run command.

Do not copy those built-in skills into the project. Inspect the existing project structure, agents, available models, project-installed skills, and actual tool or MCP configuration. If the workflow needs a separate project skill or connector that is unavailable, name the missing dependency and its exact setup requirement; do not silently install an unrelated skill or invent commands, connectors, environment variables, or credentials.

Use AgentUse-native built-in tools and already installed AgentUse skills first. When a capability is still missing, inspect these exact reference pages before configuring or recommending it:
- Spreadsheet and CSV skill: https://www.skills.sh/anthropics/skills/xlsx
- Spreadsheet skill audit: https://www.skills.sh/anthropics/skills/xlsx/security/snyk
- Gmail MCP server: https://developers.google.com/workspace/gmail/api/reference/mcp
- Gmail MCP get_message output: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/get_message
- Gmail attachment download API: https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages.attachments/get
- Google Drive MCP server: https://developers.google.com/workspace/drive/api/reference/mcp
- Authenticated browser skill: https://www.skills.sh/vercel-labs/agent-browser/agent-browser
- Browser skill audit: https://www.skills.sh/vercel-labs/agent-browser/agent-browser/security/snyk
- AgentUse filesystem tool: https://docs.agentuse.io/reference/builtin-tools#filesystem-tool
- AgentUse MCP tool filtering with disallowedTools: https://docs.agentuse.io/reference/agent-syntax#mcp-servers
- Gmail MCP OAuth setup and scopes: https://developers.google.com/workspace/gmail/api/guides/configure-mcp-server
- Drive MCP OAuth setup and scopes: https://developers.google.com/workspace/drive/api/guides/configure-mcp-server
- Drive MCP file eligibility controls: https://developers.google.com/workspace/drive/api/guides/drive-mcp-server-file-eligibility
- agent-browser security controls: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/security/page.mdx

Treat registry audit results as installation inputs, not guarantees. Review the linked findings and source files before installing a Skill. Do not install a Skill with a high-risk or failed audit without explaining the finding and receiving my explicit approval; prefer an existing project capability or a lower-risk alternative when one can complete the same job.

These URLs are authoritative inputs to the setup, not permission to install everything. Never substitute a similarly named package or MCP server. Only install an external skill when no existing AgentUse-native capability satisfies the requirement, explain why it is needed, and preserve the user's approval and credential boundaries.

Before designing the agents, audit the real permission surface of every connection. Record the credential identity, OAuth or token scopes, the actual MCP tools returned by the server, resource-level ACLs or filters, and which boundaries are enforced by AgentUse. Classify each intended boundary as Enforced, Partially enforced, or Instruction-only. Do not describe a Gmail label, Drive folder, browser instruction, or prompt sentence as a security boundary unless the credential, connector, or runtime mechanically enforces it.

For AgentUse MCP connections, use disallowedTools to remove every operation the agent does not need. In particular, evaluate Gmail create_draft, label_*, unlabel_*, and list_drafts, plus Drive create_file and copy_file. Put consequential external actions behind an AgentUse approval gate and prefer a dedicated least-privilege identity or permission-separated worker when a connector exposes broader access than this job requires.

Use this prepared execution contract:
- Workflow: receive statement → normalize transactions → search approved sources → verify matches → bundle invoices and report exceptions.
- Service stack: read the statement through a spreadsheet skill and filesystem access; search Gmail through its MCP server, then retrieve attachment bytes with a narrow read-only wrapper around users.messages.attachments.get because get_message returns attachment IDs and metadata rather than file bytes; search and write Google Drive through an available Drive MCP server; retrieve portal invoices through an authenticated browser skill; write the final bundle through a scoped filesystem tool or Drive MCP connection.
- Transaction input: source_row_id, transaction_date, cardholder, raw_vendor, normalized_vendor, amount, and currency.
- Candidate evidence: candidate_document_id, source_uri, attachment_id when applicable, searches attempted, and the match rationale.
- Reconciliation output: invoice_status, confidence when useful, verified output_path, and exception_owner for ambiguous or missing rows.
- Intended context: search only the Gmail labels, Drive folders, authenticated vendor sessions, and output folder that I provide with my representative statement. Treat these as workflow intent until the permission audit shows how each one is mechanically enforced.
- Match rule: vendor, currency, amount, and billing period must support a match. Keep receipts separate from tax invoices.
- Completion: every source row appears exactly once as matched, receipt_only, ambiguous, or missing, with source evidence or searches attempted.
- Boundaries: never purchase, change billing, delete source material, invent a match, send email, or put credentials in an agent file. Mechanically gate any consequential external write exposed by the chosen tools.

Start from this permission-separated reference architecture:
- monthly-invoice-collector: a thin manager that owns the run and delegates each stage.
- statement-normalizer: reads the statement and emits stable normalized transaction rows.
- invoice-finder: uses Gmail, Drive, and authenticated browser access to return candidate documents with evidence.
- invoice-reconciler: verifies matches, classifies exceptions, and writes the final bundle and report.

Keep this split when the roles need different tools, permissions, models, or independent tests. Collapse it into one agent when the actual environment gives every stage the same safe execution context and the split adds no operational value. Explain the final choice.

Create the .agentuse file or files in the project's established agent directory. Use only tools and skills that actually exist locally. Put narrow filesystem paths in each agent's built-in tool configuration and list unused MCP operations under each server's disallowedTools. If a required connector or enforceable boundary is unavailable, produce a valid scaffold and a precise setup requirement instead of pretending the workflow is operational. Do not enable a schedule; the first run must be supervised.

Run doctor on every file with the resolved AgentUse invocation. Run a full mock test of the end-to-end workflow, inspect the session logs and effect WAL, and fix failures. Test reject and revision branches for every approval gate.

After mock validation, prepare the interactive AgentUse setup step for the user. If AgentUse was bootstrapped through npx, use npx -y agentuse@latest setup. If the project pins AgentUse, use the same project-local invocation with setup. The user must complete provider authentication and connector authorization themselves; never request, print, or store their credentials. Do not make global installation a prerequisite for the supervised run.

At handoff, provide:
1. The final agent architecture and file paths.
2. Required connector and authentication setup.
3. A permission matrix showing identity, token scopes, exposed tools, resource controls, and any instruction-only assumptions.
4. Validation evidence and known limitations.
5. The exact interactive setup command I should run and which authorizations I should expect.
6. The exact command for one supervised run against my representative statement.
7. The review checklist I should complete before scheduling it.
8. Only after the supervised workflow is ready, explain that persistent global installation is optional and useful for recurring runs or AgentUse Serve. If AgentUse was bootstrapped through npx, offer the official global installation command for my detected package manager, but do not run it without my approval.

The agent adapts the implementation to your installed AgentUse version and actual tools.

Need agents running while your Mac is offline?