Learning AI Agents: Should You Start with Orchestration Frameworks or Model Calls?

    This article explains why beginners building LLM-powered agents should master the model call layer before adopting orchestration frameworks. It breaks agent development into four capability layers, shows a minimal hand-written retrieval-and-generation loop, covers the engineering requirements of tool calling, and outlines when an orchestration abstraction becomes worthwhile. A two-week learning path and common pitfalls are included to help readers build maintainable, production-ready agents.

    1. The Real Question Is Which Layer You Build First

    Beginners entering agent development quickly hear a trendy term: the orchestration framework. A natural follow-up question appears: if orchestration frameworks already exist, do you still need to start from the basics of model calls?

    Strip away the branding and this becomes a general engineering question: When building an application driven by a large language model, should you first master low-level API calls or high-level workflow orchestration?

    The answer is to master the low level first, then orchestration. The reason is simple: an orchestration framework does not create capability. It only reorganizes capabilities you already understand. If you do not know what actually happens during a single model call, you will have no idea where to start when the framework throws an error. Conversely, if you understand request construction, context assembly, tool-calling protocols, and state transitions, then any orchestration framework is just a matter of syntax.

    An agent can be broken down into four capability layers:

    • Model call layer: constructing requests, setting parameters, parsing responses, handling errors and retries.
    • Context management layer: prompt templates, trimming message history, retrieval augmentation, memory strategies.
    • Tool calling layer: function signature descriptions, argument extraction, execution sandboxes, feeding results back.
    • Workflow orchestration layer: chained calls, branching logic, loops and termination conditions, state persistence.

    Of these four layers, the first three are transferable, general-purpose skills. Only the fourth is where frameworks differ.

    2. Why Real Projects Quickly Spiral Out of Control

    The mental model at the beginner stage is often minimal: send a prompt, receive a reply, done. Real requirements immediately break that simplicity:

    1. Prompts must be generated dynamically from user input rather than hard-coded strings.
    2. A single task requires multiple chained model calls, where the output of one step becomes the input of the next.
    3. External data must be integrated, such as internal company documents, database records, or live APIs.
    4. Multi-turn memory is needed to keep the conversation consistent.
    5. Tools must be called to perform calculations, lookups, and write operations that the model itself cannot do.

    Without structure, code quickly degrades into a mixture of prompt strings, assorted tool functions, retry logic, and context concatenation. The typical symptoms of such code: changing one prompt requires touching three places, adding one tool means copy-pasting, and switching models means rewriting the call chain. The purpose of the orchestration layer is precisely to converge these cross-cutting concerns into a unified abstraction, not to make decisions for you.

    3. A Minimal Working Example: Write It by Hand First

    The recommended first step is to skip frameworks entirely and hand-write a minimal “retrieve then generate” loop:

    1. # Illustrative code showing the basic structure of calls and context organization
    2. def build_messages(question, docs, history):
    3. context = "\n".join(f"[{i}] {d}" for i, d in enumerate(docs))
    4. system = "You are a rigorous assistant. Answer only based on the given material, and state clearly when the material is insufficient."
    5. messages = [{"role": "system", "content": system}]
    6. messages += history[-6:] # simple sliding window to control context length
    7. messages.append({"role": "user", "content": f"Material:\n{context}\n\nQuestion:{question}"})
    8. return messages
    9. def ask(question, docs, history):
    10. for attempt in range(3):
    11. try:
    12. return call_model(build_messages(question, docs, history)) # your call wrapper
    13. except RateLimitError:
    14. sleep(2 ** attempt)
    15. raise RuntimeError("Call failed")

    These thirty lines already contain the four core questions of agent development: how to organize context, how to trim history, how to retry on failure, and how to constrain output. Once you have thought these through, then introduce any orchestration abstraction, you will know exactly what the framework is doing for you.

    4. Tool Calling: The Dividing Line Between an Agent and a Chatbot

    The key difference between ordinary question answering and an agent is whether the model can initiate actions. The common approach is to declare the name, purpose, and parameter structure of available tools in the request (usually described with JSON Schema). The model returns a structured call intent, your program executes it, and the result is fed back as a new message to enter the next round.

    Four points must be handled carefully in engineering:

    • Argument validation: arguments produced by the model are untrusted and must be validated for type and range before execution.
    • Least privilege: grant each tool only the minimum permissions required to complete the task, and require a second confirmation for write operations.
    • Timeouts and idempotency: external calls need timeouts; write operations need an idempotency key to avoid duplicate execution.
    • Loop termination: set a maximum number of iterations and a budget cap, otherwise the agent can fall into a loop that repeatedly calls the same tool.

    5. When to Introduce an Orchestration Framework

    Consider introducing an orchestration abstraction only when these signals appear: branching exceeds three levels, a human approval node is required, execution must resume after an interruption, multiple agents must collaborate, or workflow state must be persisted for troubleshooting.

    When choosing a framework, look at four things: whether it supports explicit state and resumable execution, whether it supports streaming output, whether observability is friendly (can you see the input and output of every step), and whether the community and documentation are sufficient to support debugging. If the application is a simple linear flow, calling functions directly is actually clearer—the abstraction a framework brings comes at a cost.

    If you already have cloud resources, you usually just need to plug in general-purpose building blocks: object storage for documents, a message queue for asynchronous decoupling, a container platform to host the execution sandbox, and logging plus monitoring and alerting services to trace the request path. Platforms such as Baidu AI Cloud provide this category of general infrastructure; refer to the official documentation for specific integration details.

    6. An Actionable Two-Week Learning Path

    • Days 1–3: hand-write a single-turn call and understand message roles, parameters such as temperature, and streaming output.
    • Days 4–6: add templating and a sliding window to build a small question-answering feature.
    • Days 7–9: integrate retrieval to implement question answering with traceable citations.
    • Days 10–12: implement two or three tools and complete one full “think, call, feed back” cycle.
    • Days 13–14: introduce an orchestration abstraction to rewrite the same requirement, and compare code volume and maintainability.

    7. Common Pitfalls

    The first is treating a framework as a capability, so that a single version change leaves you stuck. The second is ignoring the context budget, so a long conversation exceeds the window and quality drops sharply. The third is lacking observability, so problems can only be guessed at. The fourth is moving to multiple agents too early, overcomplicating a simple problem.

    Conclusion: An orchestration framework is an amplifier of engineering efficiency, not a prerequisite for getting started. Build a solid foundation in the three layers of model calls, context, and tool calling first, then introduce orchestration as needed. Your learning curve will be smoother, and your solution will hold up better under production conditions.