AI Integration · Composite-rebar manufacturer

AI financial and commercial directors on live 1C data

Two AI directors — finance and sales — on one database synced from 1C:UNF, with a pipeline-to-cash link and a single 'ask about the money' entry point in Telegram.

Client
Composite-rebar manufacturer
Timeline
2026
Role
Product architecture, data model, 1C…
Status
MVP assembled; deployment in progress
2
AI directors on one database
commercial (pipeline, scoring, revenue forecast) and financial (cash flow, P&L, cash-gap forecast), each with its own system prompt
8
tables in the shared Postgres schema
counterparties, deals, sales, cashflow, financial reports, insights, embeddings, Telegram users — one model for both directors
10
business API endpoints
pipeline, stale deals, cash flow, P&L, cash forecast, 1C sync, price list, structured and free-text quoting, discount check
3
volume tiers in the price catalog
wholesale / up to 15,000 m / up to 5,000 m for rebar, plus mesh priced by rod diameter, cell, and area — verified against the official price list

Context

The owner of a mid-size manufacturer reads the company through several disconnected panes: sales live in the pipeline and in managers' correspondence, money lives in 1C:UNF, and the two never meet in one place. A revenue forecast is a guess, a cash-gap warning arrives as an accountant's phone call, and a deal sold below list price is discovered — if ever — at quarter close.

The market offers dozens of 'AI director' products, but they share a structural gap: the sales tools do not see the cash, and the finance tools do not see the pipeline. The forecast that matters most to an owner — will there be money, and when — requires both.

The task

Build a working service, not a demo: two AI executives — a commercial director and a financial director — operating on the company's real accounting data, reachable through one conversational entry point, and cheap enough to run continuously. The defining requirement was the pipeline-to-cash link: the commercial director's revenue forecast must feed directly into the financial director's cash forecast, so a slipping deal immediately moves the projected cash position.

Architecture

The backbone is a FastAPI service in front of a Supabase Postgres database with pgvector, deployed on Railway. A sync worker pulls counterparties, deals, sales, and cash movements from 1C:UNF over OData into an 8-table schema — one data model shared by both directors, so their numbers can never diverge. LLM calls route through a single OpenRouter client, which lets the service switch models per task without touching business logic.

Each director is a separate service module with its own system prompt. The commercial director computes the pipeline, scores deals, flags stale ones, and forecasts revenue; the financial director builds cash-flow and P&L views and forecasts cash gaps, taking the commercial forecast as its inflow line. Ten HTTP endpoints expose these functions, and a Telegram bot wraps them into one owner-facing conversation — ask about money, deals, or prices in plain language.

Pricing engine and margin control

The official price catalog — rebar in three volume tiers across the full diameter range up to Ø40, mesh priced by rod diameter, cell size, and area — is encoded as a structured catalog verified against the current price list. On top of it sit two quoting paths: a structured endpoint for itemized requests and an LLM-parsed path that turns a free-text message like 'quote 5,000 m of 8 mm rebar and 1,500 m² of mesh' into a priced commercial offer, in the API or directly in Telegram.

The same catalog powers a discount check: actual sale prices synced from 1C are audited against list price per tier, and sales below list are surfaced with the amount of margin lost. Price discipline becomes a query, not an end-of-quarter investigation.

Outcome and what shipped

The MVP is assembled end to end: the 1C:UNF sync worker, the 8-table schema, both director services with their prompts, the pricing engine with quote generation and discount auditing, the 10-endpoint API, and the Telegram bot. Client data stays confidential by design — all credentials live in environment variables, and the pricing layer carries its own test suite.

The roadmap is staged: v1 adds bank-API feeds, entity enrichment, and RAG over correspondence via the embeddings table already in the schema; v2 adds a call module and a web dashboard, packaging the service for sale beyond a single manufacturer. The architectural bet — two executives on one database with a pipeline-to-cash link — is the part competitors lack and the part that does not need rewriting to scale.

What we built

  • 1C:UNF sync over OData

    A worker pulls counterparties, deals, sales, and cash movements from 1C:UNF into Supabase Postgres — the single source both directors read.

  • AI commercial director

    Pipeline view, deal scoring, stale-deal detection, and revenue forecast as a dedicated service module with its own system prompt.

  • AI financial director

    Cash flow, P&L, margin, and cash-gap forecast — with the commercial director's revenue forecast plugged in as the inflow line.

  • Pricing engine

    The official multi-tier catalog drives structured and free-text quoting plus a discount check that finds sales below list price and totals the lost margin.

  • One Telegram entry point

    A single 'ask about the money' bot gives the owner both directors and /quote in one conversation.