Combining Two Agent Frameworks: A Practical Path to Composite Agent Architecture

    This article examines why combining two agent frameworks can work, how their capabilities are complementary, and what it takes to make the combination hold up in production. It covers the three core design problems of a composite architecture — layering (planning versus execution), communication between layers, and context plus identity management — then walks through an end-to-end integration flow and a checklist of common pitfalls. Readers will come away with a reference architecture and a self-review list for their own multi-framework setups.

    Why “combining frameworks” deserves a serious discussion

    Most teams building AI agent applications run into the same dilemma. You pick a framework, discover it handles A well but B poorly, switch to another one, and find the strengths and weaknesses have simply swapped places. The obvious next thought is: can we combine the two and take the best of each?

    The idea sounds simple, yet systematic discussion of it is scarce in the community. Most articles stop at recommending or benchmarking a single framework. Few seriously answer the practical questions: where are the boundaries of the combination? Which layer owns the conversation, and which owns execution? How is state passed between them? How are identity and permissions unified?

    This article breaks those questions apart and lays out a reference approach to a composite agent architecture.

    Capability profiles of the two framework categories

    Frameworks differ in detail, but along capability lines the open-source agent landscape falls into roughly two groups.

    1. Conversation and reasoning frameworks

    Their core strengths are:

    • Multi-turn dialogue management: maintaining conversation history, handling context truncation and compression.
    • Intent understanding and clarification: asking the user follow-up questions instead of blindly executing.
    • Reasoning and planning: decomposing complex tasks and deciding what to do first and what comes next.

    The weakness: as soon as real external operations enter the picture — tool invocation, long-running transactions, error retries, concurrency control — these frameworks usually lack engineered execution guarantees.

    2. Task execution frameworks

    Their strengths are exactly complementary:

    • Tool invocation and task orchestration: mature task lifecycle management.
    • Execution reliability: timeouts, retries, idempotency, concurrency limits and similar engineering details already implemented.
    • State persistence: tasks can resume after interruption, which suits long-running workflows.

    The weakness: the conversational experience is typically stiff, with little multi-turn clarification and limited fine-grained context management.

    The conclusion is clear: the two capability sets are orthogonal and complementary, so combining them is sound at the architecture level. The question is not whether it can be done, but how.

    Three core problems in a composite architecture

    1. Layering: who is the brain and who are the hands

    The recommended approach is a layered architecture that separates planning from execution:

    • Conversation/planning layer: understands user intent, clarifies ambiguity, decomposes tasks, and emits a structured task description.
    • Execution layer: receives the structured task and handles the actual tool calls, orchestration, and result return.
    • Communication layer: the two layers exchange information through explicitly defined interfaces rather than sharing internal state.

    A sketch of a task description could be a JSON structure:

    1. {
    2. "task_id": "uuid-xxxx",
    3. "action": "search_and_summarize",
    4. "parameters": {
    5. "query": "Important container orchestration changes in the past week",
    6. "max_results": 10
    7. },
    8. "context_ref": "A reference or summary of the conversation context"
    9. }

    Key design point: the task description must be self-contained. Do not let the execution layer depend on internal variables of the conversation layer, or the two layers become tightly coupled and can no longer evolve or be replaced independently.

    2. Communication: what the two layers say, and how

    The biggest trap in a composite setup is usually communication. Recommended principles:

    • Prefer asynchronous: pass long-running tasks as asynchronous messages so the conversation layer can keep interacting with the user while waiting for results.
    • Use structured messages: agree on a unified message format containing task ID, status, result, and error code, and avoid passing parameters internally as natural-language strings.
    • Make the state machine explicit: define the full task lifecycle, for example pending → running → awaiting confirmation → completed/failed/cancelled. Document, at design time, which layer is responsible for advancing each state.

    For larger systems, a message queue between the two layers acts as a buffer: it smooths out traffic spikes and lets each layer scale independently.

    3. Context and identity: the most frequently overlooked issues

    In practice, these two problems are the ones most often missed:

    • Context discontinuity: the conversation layer knows who the user is and what has been discussed, while the execution layer receives only bare task parameters, so results end up answering the wrong question. Include a context summary or reference in the task description so the execution layer has the minimum necessary background.
    • Inconsistent identity and permissions: when an agent acts on a user’s behalf, where is authorization checked? The recommended approach is unified authentication: no matter how many layers a request passes through, the final tool invocation relies on the same credential system, and the execution layer trusts no internal “default allow.”

    A practical integration approach

    Based on the analysis above, the recommended overall flow is:

    1. User input first enters the conversation/planning layer.
    2. The planning layer decides whether external execution is needed: simple questions are answered directly, while complex tasks produce a structured task description and dispatch it.
    3. The execution layer runs the task and reports progress back to the planning layer through status messages.
    4. The planning layer relays progress to the user in natural language and initiates clarification or confirmation when necessary.
    5. Once the task completes, the planning layer folds the result into the conversation context to preserve multi-turn continuity.

    Pitfall checklist

    • Do not let the two frameworks call each other’s internal APIs directly; that is where coupling begins. Communicate only through the defined interfaces.
    • Define failure handling explicitly at the interface level. When the execution layer fails, the conversation layer needs fallback wording and a recovery path; raw exceptions must not be surfaced to the user.
    • Watch token cost. Task descriptions and context summaries are passed back and forth repeatedly, so design for context compression and transmit only incremental information.
    • Write one cross-layer end-to-end test before you start integrating. The hardest bugs to diagnose in a composite system almost always sit at the boundary between the two layers.

    Summary

    Combining two frameworks is not a shortcut but an architectural decision with clear engineering boundaries. It holds up on three things: clean layering, structured communication, and unified identity and context management. Get those three right and the combination not only works, it can be more robust than piling features onto a single framework. If you are running a similar composite setup, use the layering checklist above as a self-review.