← All posts

An AI portal for outstaffing: an internal ITS case study

How we built an AI agent in a week that matches engineers to positions from 50 partner Telegram chats. Stack: Django + Telethon + gpt-4o-mini + o3-mini. $40/month in production.

An AI agent for candidate matching and outstaffing automation is an internal tool we built at ITS in a week. It now lets a single operator, instead of the CEO, handle the flow of positions from ~50 partner Telegram chats. The stack is predictable: Django + Telethon + LangChain + a pairing of gpt-4o-mini (structuring) and o3-mini (reasoning-based matching). The production budget is about $40 a month. Below: what we built, how the architecture works, the production numbers, and when this approach would work for you.

TL;DR

  • Task: automate the processing of positions from ~50 partner Telegram channels and the matching of engineers from the bench.
  • Stack: Django 5.1 + SQLAlchemy + SQLite, Telethon (a user session, not the Bot API), LangChain on top of OpenAI (gpt-4o-mini for extraction, o3-mini for matching), TaskIQ + Redis for background jobs, Caddy + oauth2-proxy + Keycloak for access.
  • Budget: one VPS at ~10/month+ 10/month + ~30/month in tokens = ~$40/month in production.
  • Volume: ~1500 positions and ~200 responses a month through one operator instead of the CEO.
  • Build speed: 3 one-hour planning calls and a week of vibe coding by one senior engineer.
  • Key principle: the final decision on a response stays with a human. That is a deliberate choice, not a limitation.

What an AI portal for outstaffing is

An AI portal for outstaffing is an internal system that takes in a free-form flow of positions from messengers and email, structures them with LLM extraction, matches them against the engineer database with a reasoning model, and offers the operator ready "position — candidate" pairs with a rationale across several criteria. The final response is sent by a human, not by the agent.

It is not an "AI recruiter" that replaces a person, and it is not an RPA bot that scrolls through chats. It is a tool that takes the routine part off the operator (monitoring, extraction, first-pass matching) and leaves them what requires judgement: the final yes or no and the communication with the partner.

Context: why the manual process stopped scaling

ITS has an outstaffing line of business: we place engineers on partners' external projects. The positions come from private Telegram channels where other IT companies post roles they could not fill themselves. A channel is a stream of free-form messages: some with requirements, some without, some in English, some in a mix of languages, sometimes with a rate, sometimes without.

Before automation, the process rested on one person: the CEO. Not because he liked Telegram, but because assessing a position properly means holding several things in your head at once: who is on the bench, each engineer's current workload, the history with the partner, and a gut feel for whether the role is reasonable. Delegating it to a junior employee did not work: formal criteria do not cover "a position with a below-market rate from a partner who always pays on time — we take it for the sake of the relationship".

The bottleneck looked like this: at seasonal peaks the flow of positions outran the operator, and some of them were simply missed. Not "handled worse" — missed, because there was physically nobody to read them.

Why this was not automated earlier

If you had asked us in 2023, we would have said: "in theory an RPA bot can scroll the chat, but what to do with the description after that is unclear".

The main problem was the matching. Matching a candidate to a position is not a SQL query. The position description is free text. The candidate's CV is free text. There is no shared key between them: "Senior Python Developer, 5+ years" and "a developer with fintech experience on FastAPI" are formally about the same thing, but any regex-based matcher breaks here.

In 2024 we felt for the first time that LLMs had become smart enough to do this matching no worse than a human operator, and cheap enough to run on a continuous flow. Before reasoning models like o1/o3-mini appeared, this kind of matching broke on edge cases and the ROI of automation was negative: manual corrections ate up the gain in speed.

What we considered and why we dropped it

Bot API. The obvious first choice. It did not fit: in most partner chats a bot has no right to read the history, and inviting one requires the admin's permission. Telethon with a user session has no such restrictions.

Regexes and heuristics for extraction. We tested them on a sample. For basic fields (role title, grade) accuracy was ~70%; for compound ones (requirements, duration, free-form location) it drops sharply. Edge cases ate exactly as much operator time as we wanted to save.

Embeddings + cosine similarity for matching. Cheap, but it loses on nuance: embeddings place "5 years of commercial Go" and "a developer with a pet project in Go" too close together. On expensive B2B positions that means a lot of false positives.

An LLM-only architecture (one big model for everything). Expensive and slow. Extracting structured fields is a job for a cheap model; reasoning-based matching is a job for an expensive one. Mixing them costs more with no gain in quality.

We ended up with a two-tier architecture: a set of narrowly specialised cheap extractors on gpt-4o-mini plus one reasoning agent on o3-mini that matches fresh positions.

Architecture of the AI portal

flowchart LR
    A[Partner TG channels] -->|Telethon NewMessage<br/>user session| B[Bot worker]
    B --> Q[(TaskIQ + Redis)]
    Q --> X[Extractor agents:<br/>title / skills / rate / ...<br/>gpt-4o-mini]
    X --> DB[(SQLAlchemy + SQLite<br/>Position, Engineer, Match)]
    DB --> M[Semantic matcher<br/>o3-mini, 8-dim scoring]
    M --> DB
    DB --> P[Django dashboard<br/>unmanaged ORM, Bootstrap 5]
    P --> O[Operator]
    O -->|Response via the portal| A2[Partner]
    P --> Auth[oauth2-proxy → Keycloak OIDC]
    Net[Caddy reverse proxy] --> P

A two-tier architecture: cheap narrow extractors do the structuring, and the expensive reasoning model is used only to match fresh positions.

The Telethon worker

A Telethon user session subscribed to events.NewMessage(incoming=True) for a list of channels from the config. Each new message is normalised, stored in the database and spawns a TaskIQ background job for extraction.

client = TelegramClient(TG_SESSION, TG_API_ID, TG_API_HASH)

@client.on(events.NewMessage(incoming=True))
async def on_message(event):
    nm = await normalize(event)
    await process_position.kiq(nm.model_dump())

The unpleasant parts: we handle Telethon's FloodWaitError with an explicit await asyncio.sleep rather than skipping the offset; we back up the .session file regularly (losing it means re-authorising via SMS); and we have not yet subscribed to events.MessageEdited — partners sometimes edit a message 30 minutes after posting it, so that is on the TODO list.

Extraction: a set of narrow agents on gpt-4o-mini

No reasoning is needed here. Instead of one "big" extractor we have a set of specialised agents for individual fields, each with its own short prompt and a temperature of 0.0:

  • TITLE_EXTRACTOR — the normalised role title;
  • SKILLS_EXTRACTOR — the primary/secondary stack, separating "required" from "mentioned";
  • RATE_EXTRACTOR — rate, currency, period (hour/day/month);
  • EXT_POSITION_ID_EXTRACTOR — the external ID, if the partner provides one;
  • a few more for category, payment terms and experience.

Through LangChain, each agent receives only the relevant piece of text and returns a strictly defined field. The "many small agents instead of one big one" pattern gives focus (the prompts are short and easy to take in), cost (a cheap model is enough for the fields) and control (a prompt can be edited without breaking the others).

Matching: o3-mini with 8-dimension scoring

Only what has passed extraction and been marked as a valid position gets here. The matcher's system prompt is one of the longest in the project: instead of a short "find suitable candidates" we wrote out a weighted scoring model across 8 dimensions with explicit weights:

Dimension Weight
job_title_alignment 25%
skills_technical 25%
rate_compatibility 20%
location_match 15%
seniority_level 8%
domain_experience 4%
soft_requirements 2%
culture_fit 1%

On top of that there are hard "safety catches" in the prompt itself: if job_title_alignment < 0.5, then overall_match_score MUST be < 0.6; if skills_technical < 0.5, then < 0.65; and so on. Without these rules, reasoning models readily compensate for a weak fit on one criterion with a strong fit on another, and the final score comes out more optimistic than it should be.

The matcher returns overall_match_score, recommendation, dimension_scores, strengths, concerns, verdict and interview_questions. We deliberately kept free text in concerns/strengths: the operator sees the logic behind the decision and can tell in 5 seconds whether they agree with the model or not.

Storage and the Django dashboard

Production data is written through SQLAlchemy + Alembic: migrations, a type-safe domain layer, and no Django ORM on the write path. outstaff.db is SQLite in WAL mode. For our volume (a database under a gigabyte, one writing worker) that is more than enough.

On top of the same database sits a Django 5.1 dashboard — but through unmanaged models that mirror the SQLAlchemy schema one-to-one. It is a compromise: we got a ready-made Django admin and Bootstrap 5 templates without duplicating migrations or creating two sources of truth for the schema.

The main screen is a list of fresh positions with the top candidates, the score across the 8 dimensions, the risks, and "approve and send" / "reject" / "re-match" buttons. Every action is logged to a separate table, which gives us both per-channel analytics and an audit trail.

Deployment and access

One VPS, Docker Compose, and Caddy as a reverse proxy with automatic TLS. Authentication to the dashboard goes through oauth2-proxy → Keycloak (OIDC): the team logs in with corporate SSO, and there are no separate Django passwords.


If you have a similar process — a flow of free-form messages plus a single bottleneck in the form of a human — we can look at the scenario for free and tell you whether it makes sense to automate it. Talk to the ITS team.


Production numbers

Metric Before After
Who runs the process CEO One operator
Chat coverage ~30 channels by hand ~50 channels automatically, 24/7
Time from position to response from 2 hours to "missed it" about 15 minutes, nothing missed
Direct costs — ~40/month(40/month (10 hosting + $30 tokens)
Monthly volume "as many as he got to" ~1500 positions, ~200 responses
Codebase size — ~10,300 lines of Python + ~1,800 HTML/JS

We are not publishing matching accuracy numbers yet: we have internal measurements, but the methodology is not ready for outside scrutiny. The rule is simple: a metric without a measurement is not a metric.

The main benefit, which does not fit in the table: the CEO's focus. He stopped being the bottleneck and switched to what actually needs his involvement — strategic partnerships, hiring, the product.

What we got as a "side effect"

When you rewrite a manual process as a system, you usually get more than you planned:

  • Per-channel analytics. We used not to know which channel produced the most good positions. Now it is visible in the portal and helps us decide which chats to keep connected.
  • Interaction history. Six months later a partner asks: "did you respond to such-and-such position of ours in February?" The CEO used to dig through his direct messages; now we open the portal and see everything.
  • Tracking engineers' feedback. "I don't want embedded systems, remote only, busy until the end of the quarter" used to live in the CEO's head. Now it lives in the portal, and the matcher takes it into account at the matching stage.

What we learned (and would do differently)

  • One big do-everything prompt did not work. We had to split extraction into narrow steps: one agent for the title, one for the stack, one for the rate. The prompts are shorter, easier to edit and cheaper in tokens.
  • The matcher needed hard rules spelled out. Without MANDATORY RULES the reasoning model compensated for a weak fit on the role with a strong fit on the stack, and the final score came out more optimistic than it should have.
  • We decided from the start to leave the final step to a human. There was a temptation to auto-respond on a high score, but in B2B the cost of a false-positive response is higher than the gain in speed. We do not plan to change this decision.
  • The CV database is the main bottleneck. The model is exactly as good as the information about the engineers is structured. Half of next quarter's effort goes into annotating bench profiles.

When this approach would work for you

The logic can be reproduced in any niche where four conditions hold:

  1. The data source is a messenger, email or a CRM in free form. If you already have a structured ATS with standard job forms, LLM extraction will add noise, not accuracy.
  2. One person (often the founder or the COO) holds the process in their head, and that is the bottleneck. Without this pain the project will not pay off.
  3. The decision takes two steps: structure the input and compare it against a database. Not reasoning across the whole domain, not a complex workflow with dozens of branches.
  4. The cost of an error is tolerable, and the final decision can be left to a human. If a mistake costs a $200K deal, it is better to spend more time on design than to rush.

If all four conditions hold, there is a chance you will build your own version for similar money in a similar time. If even one breaks, it is better to start by analysing the process rather than choosing a stack.

When this approach does NOT work

So that this does not sound like "build AI agents everywhere":

  • The cost of an error is high and human-in-the-loop is not available — don't do it. Automatic action in B2B without an operator is a reliably bad idea.
  • The input data is well structured. An ATS with standard job forms does not need LLM extraction — you will add noise and cost.
  • The volume is a few dozen messages a day. Manual work is cheaper than the infrastructure.
  • Matching is built on hard rules (an exact match of certificates or licences) — an LLM will add noise, not accuracy.

At ITS we usually start internal and client projects like this by mapping the process against these four questions — before choosing a stack or a model. Most "this can't be automated" turns out, on inspection, to be "this can be automated if the final decision stays with a human" — which changes the picture considerably.

FAQ

How much does it cost to build an AI portal for candidate matching? In our case, about 35–40 hours of a senior engineer's work over a week, plus ~40/monthinproductionoperatingcosts(40/month in production operating costs (10 hosting + ~$30 in OpenAI tokens). Building one from scratch for a different niche will take comparable time if the input is Telegram/email and the matching fits the two-tier "extraction + reasoning" scheme.

Why o3-mini for matching when there are cheaper models? We tried gpt-4o-mini for matching too — accuracy drops on nuances like "this person wrote Go for 2 years, the rest is Python; are they a fit for Senior Go?". At volume that means dozens of extra incorrect responses a month, which breaks partners' trust. The cost difference is on the order of $0.05–0.10 per match; at 200 responses a month that is a handful of dollars.

Why SQLite and not Postgres? One worker writing, one UI user reading, less than a gigabyte of data. SQLite in WAL mode handles that comfortably and needs no separate container, no backup more complicated than cp database.db backup.db, and no monitoring. When we hit the limits, we will migrate to Postgres in an evening.

Why Django if the main data layer is SQLAlchemy? We needed a dashboard with minimal frontend effort. Django + admin + ready-made Bootstrap templates covered that in a day. To avoid maintaining two schemas, the Django models mirror the SQLAlchemy schema as unmanaged. The single source of truth is the Alembic migrations.

Why Telethon and not the Bot API? In most partner Telegram chats a bot has no right to read the history, and inviting one requires the admin's consent. Telethon with a user session works on behalf of a real account that is already a member of those chats, and has no such restrictions. Telegram officially permits automation over MTProto within the general rate limits.

Can this be done without an engineer, on n8n or Make? Parsing and extraction — yes. LLM matching with decent accuracy — hardly: it needs work with the context of the CV database, deduplication, history and a feedback loop. With low-code you will get to MVP level, but it will quickly hit a ceiling: either the token cost of every run or the quality of the matching.

How do you get around the Telegram TOS for user accounts? We don't get around anything. Telegram explicitly permits automation through Telethon/MTProto as long as you respect the general rate limits and the ToS. Partner chats are private communities that we have been invited into as members.

Where is the biggest bottleneck right now? The quality of the CV database. The model is exactly as good as the data about our engineers is structured. Half of the effort over the next quarter goes into annotating bench profiles: explicit stack tags, the history of partner feedback, availability.

How much time did the build actually take the engineer? Roughly 35–40 hours of net work over a week. No overtime, no heroics. Most of it was not code but rewriting prompts and fighting edge cases in the chats.

Can o3-mini be replaced with Claude or DeepSeek? Architecturally, yes — it is a change of 1–2 lines through LangChain. The important part is to re-run the matcher prompt on a held-out sample, because the MANDATORY RULES are sensitive to how a particular model interprets "MUST" in instructions.

Summary

3 planning calls. A week of a senior engineer's work. ~$40/month in production. A CEO who no longer has to live in Telegram. One operator instead of one founder.

The main lesson for us is not about code but about how far the "this can be automated" boundary has moved over the past year and a half. Tasks that seemed too dependent on human judgement now cost $30/month in tokens, if you decompose them correctly into structuring the input + a reasoning-based comparison.

The most uncomfortable part: we put this project off for a year and a half because "well, you can't automate that sort of thing". Perhaps your company has a similar task that is also due for a second look.


If you want to discuss how AI agents would fit your processes, write to us. We will go through the task, show similar implementations and propose a pilot format. For the first 3 companies with a relevant scenario we are ready to do a free technical review and help design an MVP for your process.

Talk to the ITS team

Contacts:

Got an X?

Start with the free discovery. In a week you'll know where your Z is.

Start discovery