{"slug": "ai-agent-architecture-5-questions-before-writing-code", "title": "AI agent architecture: 5 questions before writing code", "summary": "A developer outlined a five-question framework for designing AI agent architecture before writing any code, covering task division between agents and programs, execution environment, available data, desired outcome, and result delivery. The approach is illustrated with an Instagram Direct AI sales assistant that splits responsibilities between Python, which enforces a conversation script and validates collected information, and Claude, which draws on instructions and a knowledge base to generate replies, with a human doctor confirming appointments routed to Telegram.", "body_md": "I always start an AI system's architecture by analyzing the problem we need to solve and the data we have. That determines which platform should run the automation and which tools to use\n\nChoosing a solution means answering five questions\n\nWho does what: an AI agent, a Python program, or a combination of solutions\n\nWhere the work happens: on a remote virtual private server (VPS), on a computer, or somewhere else\n\nWhat data is available: where requests come from and which knowledge base the system can use\n\nWhat result we want: an appointment, an inquiry, or another action\n\nHow we receive that result: where it arrives, in what form, and how often\n\nThese answers define the architecture: what each component does, where it runs, which data it receives, and what it passes on. The choice of tools follows their roles in that workflow\n\nFor example, my AI sales assistant for Instagram Direct uses this division of responsibilities. It needs both a natural conversation with the client and strict adherence to a script. The solution therefore combines Python code and Claude, each with a different job\n\nPython controls progress through the script: has all the required information been collected, and does the model's response stay within the defined boundaries? Claude uses its instructions and the knowledge base to determine what to say to the client\n\nThe conversation script and the knowledge base have different roles in this architecture. The script defines the workflow with the client and the information that must be collected. The knowledge base supplies the content for answers. Code and the model connect those parts: a natural conversation still has to follow the defined script\n\nThe other parts connect to the intended outcome as well: requests arrive through Instagram Direct, and the information collected during the conversation goes to the doctor as a card in Telegram. The appointment is created after the doctor's confirmation. A person therefore belongs in the workflow too, retaining that decision\n\nThis defines the AI system architecture: responsibilities are divided between code, the model, and a person; the required data and the path to the intended result are defined. And notice that all these decisions happen before the first line of code", "url": "https://wpnews.pro/news/ai-agent-architecture-5-questions-before-writing-code", "canonical_source": "https://dev.to/matintellect/ai-agent-architecture-5-questions-before-writing-code-1lo0", "published_at": "2026-10-16 01:54:28+00:00", "updated_at": "2026-10-16 02:00:27.699722+00:00", "lang": "en", "topics": ["ai-agents", "artificial-intelligence", "large-language-models", "ai-tools"], "entities": ["Claude", "Python", "Instagram Direct", "Telegram"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/ai-agent-architecture-5-questions-before-writing-code", "markdown": "https://wpnews.pro/news/ai-agent-architecture-5-questions-before-writing-code.md", "text": "https://wpnews.pro/news/ai-agent-architecture-5-questions-before-writing-code.txt", "jsonld": "https://wpnews.pro/news/ai-agent-architecture-5-questions-before-writing-code.jsonld"}}