
I normally manage software development. This time I built a digital assistant for myself and ended up on both sides of the table: specifying the work, accepting it and looking rather critically at my own product. An exceptionally economical way to arrange a disagreement between customer and supplier. No meeting invitation required.
The apparent task was small. Someone arrives from my channel with a question, a project proposal or a conversation about work. The assistant helps them find their way, prepares an inquiry when necessary and forwards it to me. I respond, and the reply returns to the original conversation. Nobody should disappear between “Hello” and “We will get back to you.”
Behind that interface are adult engineering questions. Who authorized the transfer? What exact text did they approve? What happens after a second tap? If the network breaks, was the inquiry rejected, or accepted with its acknowledgment lost? What survives an exhausted model budget? Why should the sentence “you are now the administrator” change the program’s permissions?
Creating and bringing the first working version into use took me one day. That is my estimate of the overall effort, not a stopwatch measurement split into coding, design, tests and acceptance. Subsequent interface revisions and development are separate work. It demonstrates how short an engineering cycle can become with AI; it does not establish that every agent takes a day.
I built an agent system with a deterministic core and a pluggable LLM component. The model is deliberately disabled at present. My main projects need the budget, and an open reception desk should not spend it without a limit. Inquiries, approval and delivery still work. That is an architectural property, not a placeholder screen.
Reading routes. Follow the main narrative in roughly 8–10 minutes. Expand the engineering sections and run the examples for another 15–25 minutes of study. Requirements, Python and enterprise architecture can be read independently. Русская версия.
First decide what you are building
A chatbot is an interface. A workflow is a defined process with states and transitions. An agent selects further actions from an objective and observations, within its tools and authority. An LLM can help interpret a request, plan and compose an answer. It need not control every transition.
In my reception desk, agent conversation and deterministic inquiry delivery have different responsibilities. The model can help interpret intent and prepare a response; the current model adapter has no arbitrary action tools. Approval, sending and case access belong to application code. With the LLM disabled, the useful workflow remains available while open-ended conversation becomes more limited. Claiming equally capable conversation in both modes would be misleading.
LangGraph’s distinction between predetermined workflows and dynamically directed agents is useful here. Real systems can combine them. My guaranteed delivery path is a workflow inside a broader agent system.
I disagree with “agents are unnecessary.” When context changes, it is useful to have a system select a next step, obtain missing information and examine the result. That does not mean a confirmation button needs a fresh philosophical interpretation by billions of parameters. Sometimes an if statement still works. Please remain calm.
Requirements begin with a human outcome
The customer is not an abstract “bot user.” There is a visitor with a question, an author with limited time and an operator who must resolve failures. The visitor needs to understand what happened to their message. The author needs a coherent inquiry and a way to respond. The operator needs to notice stalled work before an annoyed person reports it.
Those outcomes become invariants: nothing is forwarded without approval; approval applies to an exact text; one conversation cannot access another; a transport acknowledgment is not evidence of a human reading a message; losing the model does not block the core path.
Engineering layer · functional and nonfunctional requirementsRoles, scenarios, contracts and acceptance criteria
Functional contract
| ID | Requirement | Acceptance evidence |
|---|---|---|
| F1 | Independent inquiries from one visitor | A new topic creates a separate case rather than overwriting the old one |
| F2 | Complete preview before transfer | All submitted text is shown; long messages are split without silent truncation |
| F3 | Approval of a specific revision | Editing the text invalidates the old confirmation |
| F4 | Identity and expiry checks | Only the case owner can approve; an expired preview must be refreshed |
| F5 | Durable intent to deliver | Approval and queue insertion cannot diverge after a process failure |
| F6 | Author reply to the original conversation | The author also previews and confirms their response |
| F7 | Honest status | Queued, accepted by transport and outcome unknown are different states |
| F8 | Operation without an LLM | Disabling the model, removing its key or exhausting its limit preserves the workflow |
These are executable acceptance scenarios. Given: the visitor saw revision 3. When: they edit the text and press the old confirmation. Then: nothing is sent, and the interface requests a current preview. No model is needed to test this, and there is no argument about whether the response sounded sufficiently intelligent.
Nonfunctional contract
Separate hard properties from target measurements. “Another user cannot approve this case” cannot be compensated for with a pleasing average success rate. “95% of previews render within two seconds” is an example of a future objective, not a published measurement of my bot.
| Area | Current decision | Work needed at larger scale |
|---|---|---|
| Durability | SQLite, transactions, persistent queue | Concurrency validation; HA storage when the SLO requires it |
| Budget | Model-attempt limit, bounded output, model-free mode | Monetary reservation before calls and cost per completed inquiry |
| Privacy | Conversation isolation, bounded model context, body-free event logs | Retention/deletion policy and role-based access to data and keys |
| Recovery | Database backup and integrity checks | Restore the whole service on a clean host and measure RTO/RPO |
| Operations | Health, queue age, stalled attempts, alerts | SLOs, on-call responsibility and a load model |
| UX | Readable text, explicit approval, physical-phone checks | Accessibility and long-message/unreliable-network scenarios |
RPO is the amount of recent data loss a service can tolerate. RTO is its recovery-time objective. A daily database copy proves neither zero data loss nor recovery in five minutes. Those require a separate exercise.
Each requirement needs an owner, priority and evidence. For this first version, approval, delivery, isolation and durability matter more than unrestricted conversation. In a research product where reasoning is the value proposition, disabling the model would be a much larger degradation. Design a fallback for the actual job instead of announcing a universal resilience trick.
A workflow beyond the happy arrow
The working implementation uses Python, SQLite and the Telegram Bot API. A separate bridge connects the public assistant to my notification delivery. The public process does not inherit every other component’s credentials. APIs here are real integration contracts; this personal reception desk does not need an additional public REST service simply to claim it has an API.
The diagram includes editing, expired approval, an unavailable model and uncertain delivery. If those branches are missing from the requirements, they will still appear later, in operations.
Scroll horizontally to explore the workflow, or open the full-size version.
Open full-size workflow ↗The visitor approves a snapshot. The system records a job before making the network call. A worker performs delivery separately and records the outcome. The interface, business transition and transport therefore do not become one long function dependent on good weather.
Engineering layer · states, outbox and the awkward UNKNOWNA timeout does not prove that a message was not delivered
Three concepts matter: a state machine, a transactional outbox containing durable intent for an external effect, and idempotency, which prevents one logical action from being executed repeatedly.
A case has an identity, an owner, a text revision and a state. Its preview stores a snapshot, expiry and links to the messages actually shown to the visitor. Confirmation checks these conditions rather than merely recognizing the word “yes.” In the working assistant, a preview expires after 15 minutes. Editing creates a new version requiring another review.
The delivery queue moves through queued → sending → accepted | rejected | unknown. Queued means intent has been recorded. Sending means a transport attempt started. Accepted means transport acknowledged it, not that I read it. Rejected is a definite refusal. Unknown means observation ended before we could determine the external outcome.
Suppose Telegram accepted the message but its response was lost. Retrying immediately can produce a duplicate inquiry. The implementation therefore does not automatically retry an unknown outcome. It requires investigation. After a process crash, unfinished sending attempts also become unknown.
A destination supporting idempotency keys can associate a retry with the original action. A destination exposing reliable receipt lookup may allow reconciliation. Otherwise an operational procedure is necessary. Writing “exactly once” in a README does not remove network uncertainty. Unfortunate, since writing those words is considerably cheaper.
Long-message approval introduces another boundary. Saving the correct snapshot is insufficient: the visitor must actually see every part. Otherwise they approve content they never reviewed. This requirement belongs simultaneously to UX, process correctness and security.
For an enterprise version I would add contract versioning, correlation IDs, bounded worker leases and fencing against a stale worker. Those are proposed extensions, not capabilities I am pretending the small deployment already has.
Why algorithms matter in a world of language models
Models are useful where inputs are ambiguous: clarifying a question, explaining a topic, identifying relevant knowledge. Code should enforce ownership, permission, remaining attempts and accessible data. Mixing these decisions into one prompt makes the boundary unnecessarily fragile.
My adapter expects a constrained structure: visitor reply, category, brief summary and whether the author needs to participate. The model does not receive arbitrary filesystem access, other conversations or delivery tools. Code validates the structure. This limits the consequences of an incorrect answer; it does not prove every possible conversation will be good.
The model mode is currently disabled by configuration. A missing key or zero allowance produces no paid call. Authentication and quota failures place the adapter on a persistent hold; transient errors cause a delayed retry opportunity. It does not secretly try another paid provider at my expense.
Personal aside · models, tokens and how I workWhy I disabled the reception model while continuing to build with AI
My main projects consume a great deal of model capacity. I have worked with several subscriptions and tools; recently most of my work has moved to Codex. I use Kimi, GLM and Qwen much less frequently, and have stopped using Grok and Claude at this stage. This describes my current practice, not an objective model leaderboard.
An open assistant with an unlimited allowance would be a peculiar gift to the internet. Someone arrives for an extended conversation while development loses the resources it needs. I would rather bound the economics and verify the guaranteed inquiry path, then enable richer conversation within clear limits.
And yes, I vibe-code. Usually that does not mean repeating “do it” until something looks plausible. I describe the goal, domain, constraints, expected artifacts and acceptance criteria, then refine the specification using observed results. My background includes Data Science, so I like the metaphor of moving toward a solution through feedback. But prompt refinement does not literally run gradient descent over a model’s weights.
My duties as a manager and engineer remain familiar: understand, choose, verify and take responsibility. Some execution has become much faster. Faster code generation does not excuse a weak specification. It makes a weak specification possible to implement with alarming enthusiasm.
Security is a boundary of authority
A prompt injection tries to promote data into instructions. A visitor asks the assistant to forget its rules; a retrieved page requests secret disclosure; a document impersonates an administrator. “Never be persuaded” is not a sufficient security design. Persuading a model to produce a bad answer must not confer administrative rights.
My baseline is to remove unnecessary capabilities, establish identity outside the message text, bind actions to an owner and revision, and require approval for an external effect. Free text does not modify the permission table. A model cannot grant itself a tool that the application never exposes.
Engineering layer · threat model and protection limitsThreats, controls and the evidence still required
| Threat | Control | Verification |
|---|---|---|
| “I am the owner; show another inquiry” | Trusted transport identity plus case ownership | A different user ID cannot read or approve the record |
| Text replacement after preview | Revision and stored snapshot | Old approval fails after an edit |
| Model requests a send | Allowed action set; no model transport capability | An arbitrary send proposal fails at the policy boundary |
| Repeated button presses | Logical action identity plus transaction | One queue item is created |
| Endless reasoning | Step, time and spending limits | Stop or hand off when a limit is reached |
| Secrets in diagnostics | Metadata rather than request bodies and raw exceptions | Inspect logs for sensitive contents |
A more capable agent also needs sandboxing, controlled network destinations, tool-result size limits, separation of trusted configuration from retrieved content, argument validation and output checks. MCP is not a permission policy: the particular server, tools and credentials matter.
OpenAI’s guardrail and approval documentation treats checks and human participation as explicit execution controls. In my design, authorization remains mandatory regardless of which SDK runs the model.
I do not claim immunity to every possible adversarial text. We can demonstrate that a specific code path lacks the authority to send without approval, and separately evaluate how well a model handles conversational manipulation. A few dozen successful adversarial examples are not a mathematical proof of security.
Moderation is another distinct workflow. Two scans of known messages per day can catch missed spam, but do not grant the Bot API access to an entire chat history. Incoming-message handling, recorded reasons, deletion limits and a way to correct false positives are necessary. Letting a model delete everything it finds suspicious is an efficient way to moderate a group into silence.
Hello World: run the approach yourself
The accompanying Agent Workflow Lab repository is an independent educational implementation with synthetic data. It contains no personal conversations, server addresses, credentials or deployment internals. The core example runs without a model or network requests.
git clone https://github.com/vovlov/agent-workflow-lab.git
cd agent-workflow-lab
python3 agent_lab.py
python3 -m unittest -v
It demonstrates a library API for cases, previews and approval, a persistent outbox and a bounded decision loop. It is a starting point for an experiment, not a ready public service: authentication in an HTTP/Telegram adapter, operational controls and storage protection remain your responsibility.
Practical layer · Python, a bounded agent loop and LangGraphRunnable examples: what the agent proposes and who executes
The smallest useful path looks like this. Here, alice is a principal already authenticated by a trusted adapter. Accepting that value from request text would not authenticate anyone.
from agent_lab import Inbox
box = Inbox('demo.sqlite')
case_id = box.create('alice', 'I would like to discuss a project')
preview = box.preview('alice', case_id)
print(preview.text) # The UI must show all submitted content.
# Call only after explicit visitor approval.
job_id = box.approve('alice', preview)
print(box.dispatch(lambda job, text: 'accepted'))
box.close()The delivery function is a simulator. No real message is sent. Repeating approval with the same snapshot creates no second job; editing the case invalidates the old snapshot. A transport exception leaves an unknown outcome without automatic retry.
The second example is a bounded agent loop. A planner receives observations and proposes an action. The executor permits reading two educational FAQ entries or returning an answer. A send action is rejected. You can inspect the separation between a decision and authority without spending tokens.
from agent_lab import discuss
def planner(observations):
if len(observations) == 1:
return {'action': 'faq', 'key': 'contact'}
return {'action': 'answer', 'text': observations[-1]}
print(discuss('How do I make contact?', planner, max_steps=3))The planner is deliberately scripted. An LLM adapter would return the same contract and face the same executor checks. Real providers also need deadlines, schema validation, input/output limits, budget reservation and attempt accounting. Replacing the simulator with a model does not remove these requirements.
LangChain provides model and tool integrations and facilities for common agent patterns. LangGraph becomes useful when explicit state, branches, interruption and resumption matter. They are related tools, not two mandatory layers beneath every application.
The repository includes a LangGraph version: prepare a snapshot, interrupt for a human, validate approval, then deliver. The business checks remain in the same Inbox, so moving orchestration into a graph does not change the system’s authority.
# This optional example requires Python 3.10 or later.
python3 -m venv .venv
.venv/bin/pip install -r requirements-graph.txt
.venv/bin/python langgraph_demo.pyAn important interrupt/resume detail: a node can execute again on resumption. Do not put an external send before the interruption and assume it will happen once. The example prepares the snapshot in a separate node and later approves that stored version.
Its InMemorySaver is appropriate for a short demonstration, not process-restart durability. A durable deployment needs a suitable checkpointer. LangGraph distinguishes a thread’s execution checkpoints from a store for information outside one thread. Neither replaces case ownership checks.
Try breaking the sample: approve as another principal, edit the text, expire the snapshot or make delivery raise after the simulated remote acceptance. These exercises teach more about agent engineering than a tenth successful “Hello, world.”
Observability: the bot is alive, but the work has stopped
A process can answer a health check while failing to deliver inquiries for days. I therefore watch work progress: last successful polling, oldest queue item, new unknown outcomes, database availability and disk capacity.
The working assistant has a separate monitor and database backup. It checks queue delay, polling freshness, model state and storage. Alerts follow state changes and recovery. Logs need identifiers and reasons, not the visitor’s entire conversation just in case.
Engineering layer · metrics, tracing and testsDistinguishing process availability from successful work
I divide future measurements into three groups. Product: started inquiries reaching confirmation, time to a human reply, and cases needing repeated explanation. Reliability: queue age, unknown outcomes, persistence errors and recovery success. Model: useful answers on an evaluation set, category correctness, escalation frequency and cost per accepted inquiry.
Token count is not an outcome. Unit economics divides model, infrastructure and human-review cost by useful completed inquiries. A cheap model whose work must be rewritten may not be economical at all.
A small service can begin with structured events and queue state. Across services I would add a trace ID and spans for intake, model execution, policy checks, queue insertion and transport. OpenTelemetry offers a common language for traces, metrics and logs. This is a proposed extension; the current assistant is not presented as an already deployed OTel platform.
Cardinality has a cost. A case ID belongs naturally in an event or trace; using it as a metric label across millions of cases may create a different problem. Conversation bodies should not enter telemetry by default. Access, retention and redaction deserve explicit design.
During this article’s preparation, 95 automated checks of the working assistant passed again. The educational repository tests its own invariants independently. Model-adapter tests inject synthetic responses and failures; no paid calls were made for the article. This demonstrates tested transitions, not live conversational quality for the disabled model.
| Layer | What to test | What the evidence establishes |
|---|---|---|
| Unit/property | Transitions, ownership, expiry, replay | Specific invariants over the selected inputs |
| Integration | Database, queue, transport contract | Component interaction and known failure handling |
| Fault injection | Crashes around commits and network calls | Behavior at specified failure points |
| Model eval | Ambiguity, manipulation, style | A chosen model’s performance on a versioned set |
| UI/E2E | Long text, editing, multiple devices | The tested user journey in particular clients |
| Operations | Clean-host restore and load | Measured recovery and capacity for that environment |
An evaluation set should separate ordinary inquiries, incomplete requests, multiple topics, adversarial prompts and requests outside the assistant’s capability. Label the expected action and forbidden claims. “Vladimir has already agreed to the meeting” must fail when unsupported, however polished its wording.
How this changes in an enterprise
For a small personal service I own one process, one infrastructure and a bounded set of data. A company adds multiple product owners, employee permissions, regulatory requirements, shared model infrastructure and the cost of a widespread mistake. Some complexity is justified. Mocking all of it would be convenient and unhelpful.
Building a universal platform before verifying the first scenario is still risky. A team can spend months choosing an orchestrator without learning whether anyone needs the outcome. I would start with a vertical slice: one process from entry to an evidenced result, including permissions, observability and manual failure resolution. The next process reveals which capabilities deserve to be shared.
Architecture layer · small team, enterprise and framework choiceWhen one service should become shared infrastructure
Scroll horizontally to explore the workflow, or open the full-size version.
Open full-size workflow ↗| Decision | Personal product / small team | Enterprise version |
|---|---|---|
| Entry | One Telegram adapter | Multiple channels, identity gateway, tenant context |
| Policy | Explicit application checks | Shared access rules plus domain authorization |
| State | One durable workflow | State storage, migrations, competing workers |
| Tools | A minimal permitted set | Owned, versioned contracts and scoped credentials |
| Model | One optional adapter | Gateway, quotas, requirements-based routing, data controls |
| Release | Scenario checks and rollback | Model/prompt/code versions, eval gates, canary rollout |
| Support | A known owner | On-call responsibility, SLOs, audit and incident procedures |
A model gateway centralizes quotas and routing. It does not automatically know whether a particular contract permits a payment. The orchestrator knows step state; the domain service checks the meaning and authority of the action. Clear boundaries prevent one clever component from quietly inheriting keys to the whole building.
I choose ordinary code when the state and branching are small and understandable, accepting responsibility for its lifecycle. LangChain helps with model integration and common agent patterns. LangGraph helps with controlled graphs, pauses and resumption. Agents SDK is another option for agent loops, tools and handoffs; its official documentation explains that role. SDK choice does not design your database, authorization or delivery semantics for you.
Long-lived business processes also need an evaluation of durable execution: crash replay, version compatibility, compensation and transaction boundaries. Not every process needs a dynamic planner. A mandatory financial check cannot be skipped because a model decides to optimize the route.
I would proceed in three stages. First, one scenario with exit criteria and a budget ceiling. Second, a scenario owned by another team to test repeatability. Third, shared components with real consumers and support ownership. If the second scenario needs a different design, learning that is valuable too. It is cheaper than a premature universal standard.
What works, and what deserves to come next
The result is a working assistant with explicit boundaries: it accepts inquiries, retains case context, requests approval, transfers a message and returns the author’s reply. The model component is implemented and disabled; enabling it requires a separate conversation-quality and budget check. The core service does not depend on available tokens.
The next mature step is not to attach five more models. I want measurements of completed inquiries, confusing interface moments, manual correction and recovery after failure. If those expose an architectural limit, there will be a concrete reason to change it.
This connects to my broader work on LAF: accelerating development with agents while preserving specification, verifiability and responsibility. Behind that is a question from the book I have been writing for about two years, «Право на своё»: when tools let one person do more, how can that capacity support independent work and shared ownership of the result?
You can take the educational code and experiment independently. To discuss an agent for your own process, start with three things: who the user is, which action must reach an outcome and which failure is unacceptable. That is already enough for a concrete conversation with my assistant.
Yours, Director of Project Portfolio Management — ДПУПП
Related Articles
RAG for a company: from document search to a useful assistant
RAG explained from the ground up: indexing, retrieval, small-team and enterprise architectures, published implementations, evaluation, and the path from answers to useful actions.
Building an Alternative Is Only the Start: Calculate the TCO
Compare a product, fork, compatible implementation, and bespoke build through total cost of ownership: upgrades, operations, skills, risk, and exit.
“Like FAANG,” Without the Cargo Cult: Bring the Context With the Practice
Architecture practices cannot be separated from scale, team structure, and operational maturity. Here is how to spot accidental complexity before adopting them.