Skip to content
Bkper Bkper

Bkper Agent

by Bkper

Automatically extracts transactions from uploaded documents using AI. Drag invoices, receipts, or bank statements into your book — the agent extracts dates, amounts, and descriptions, then finds the right accounts based on your transaction history.

The agent learns from your corrections and improves extraction accuracy over time.

How it works

sequenceDiagram participant Book as Bkper Book participant Agent as Bkper Agent Book->>Agent: File uploaded Agent->>Agent: Extract transactions Agent->>Agent: Discover accounts Agent->>Book: Create draft transactions Note over Book: Drafts reviewed and posted Book->>Agent: Transaction posted Agent->>Agent: Learn from corrections

Upload — select an account and drop a file into the book. The agent extracts transactions from the document and creates drafts. For bank statements and CSVs, it creates one transaction per line item. For invoices and receipts, it creates a single transaction.

Attach — drop a file onto an existing transaction. The agent extracts data and updates the transaction with the extracted amount, date, description, and custom properties.

Note: Attachments are always treated as invoices or receipts, even if the file is a multi-page statement.

The agent detects the document type automatically:

  • CSV files are always treated as statements (one transaction per row).
  • PDFs and images are analyzed to decide if they contain a statement table (multiple transactions) or an invoice/receipt (single transaction).

Account discovery

After extracting data, the agent assigns From and To accounts by searching your book's transaction history for similar patterns:

  1. Extract key terms — AI identifies meaningful parts of the description (e.g. Office Depot from OFFICE DEPOT #1234 PURCHASE 04/15)
  2. Search by account + creator — finds posted transactions with similar terms, scoped to the selected account and user
  3. Search by account — same search, any user
  4. Search by description — searches across all accounts
  5. Pick by frequency — assigns the most commonly used accounts from matching results

When you correct an account and post the transaction, the agent re-runs discovery on all pending drafts in the book — one correction can fix many.

When the agent finds matching transactions to determine the accounts, it also looks at the custom properties on those historical transactions. If every matching transaction shares the same property (for example, a consistent category or project code), the agent copies that property onto the new draft. Properties that have already been auto-copied are tracked per-account so they are not suggested again.

The agent also extracts amounts and dates from transaction descriptions using AI, even without a file upload.

Learning from corrections

When you edit an AI-extracted transaction and post it, the agent compares the posted version against its original extraction. If the data changed significantly, it improves its extraction instructions:

  1. Reflect — analyze what the extraction got wrong
  2. Curate — generate new instructions and merge with existing ones
  3. Validate — re-extract the document with the improved instructions and verify results are better without regressions

The improved instructions are saved to agent_prompt on the account or group. Future documents processed through that account benefit from the accumulated learning.

For invoices, this runs immediately on post. For statements, the agent flags the account and processes improvements asynchronously.

When an account or group has no stored prompt yet, the first posted transaction through that account can establish a baseline prompt automatically — even if you made no corrections. This gives the agent a starting point for future improvements.

Configuration

Account and group properties
Property Description
agent_prompt Custom extraction instructions for documents uploaded to this account or group. The agent appends learned instructions here automatically
agent_prompt_id Identifier used to match uploaded files by filename. When a filename contains this value, the agent uses this account's prompt for extraction. Defaults to the account name
agent_prompt_skip JSON array or comma-separated list of property keys to ignore during extraction comparison and learning
agent_parser_url URL of an external extraction service. When set, file parsing is delegated to this endpoint instead of using built-in AI

Example — custom extraction instructions:

YAML
agent_prompt: |-
  Extract transactions from the statement table.
  - Do not include header rows
  - Include the reference number as a property called "ref"

Example — skip properties that vary per transaction:

YAML
agent_prompt_skip: ["trade_date", "settlement_date"]
Book properties
Property Description
agent_parser_url URL of an external extraction service for all files in this book. Account and group agent_parser_url take priority
Events handled
Event Behavior
FILE_CREATED Extracts transactions from the uploaded file and creates draft transactions. Delegates to external service if agent_parser_url is set
TRANSACTION_CREATED When a transaction has an attached file, extracts data and updates it. Also runs account discovery and AI-based amount/date extraction on all new transactions
TRANSACTION_POSTED Compares posted data against the original AI extraction and improves the prompt if corrections were made. If the posted transaction's credit or debit account changed, the agent re-runs account discovery on pending drafts in the book (skipped when the backlog has more than 50 items)
TRANSACTION_UPDATED Same as TRANSACTION_POSTED
TRANSACTION_DELETED Flags the source account for prompt improvement when a statement-extracted transaction is deleted, indicating a false positive
BOOK_AUDITED Processes one flagged account or group, running the full improvement pipeline for statement extraction
Supported file types
Format Extensions
CSV .csv
PDF .pdf
Images .jpg, .jpeg, .png, .bmp, .webp
External extraction service

When agent_parser_url is set, the agent delegates file parsing to that URL instead of using built-in AI. The lookup priority is:

  1. Account property
  2. Account's group property (first match)
  3. Book property

The service receives a POST request with the file content (base64-encoded), full book metadata, and account context. It returns structured transactions in JSON format.

Each transaction can optionally include:

  • book_id — record the transaction in a different book than the upload target
  • account_name — assign the transaction to a specific account by name

The service can also return file.properties (e.g. bank_name, account_number, statement_period). These are stored on the uploaded file and become searchable inside Bkper.

This is useful for specialized parsers that handle bank-specific or proprietary statement formats.

Transaction metadata

The agent stores metadata on processed transactions. These are internal properties (suffixed with _) used for learning and traceability:

Property Description
agent_extracted_ Original AI extraction data (JSON). Used to detect corrections when the transaction is posted
agent_file_id_ ID of the source file. Links statement transactions to their document
agent_credit_account_id_ ID of the discovered credit account
agent_debit_account_id_ ID of the discovered debit account
agent_description_part_ The key term that matched during account discovery

Learn more