Back to blog

Declarative Agent Architecture: Define What Your Agent Does, Not How It Orchestrates

Octavus Team··8 min read

The AI agent ecosystem is growing fast, but most frameworks share a common design flaw: they force developers to write imperative orchestration code. Graph definitions, state machines, node functions, manual routing — all of this is infrastructure that has nothing to do with what your agent actually does. There's a better way.

The Problem with Imperative Agent Development

If you've built an AI agent with a popular framework, this probably looks familiar: you define a graph of nodes, write functions to handle state transitions, manually manage conversation history, set up streaming pipelines, and wire together tool execution loops. The orchestration code quickly dwarfs the actual agent logic.

This imperative approach creates several problems that compound as your agent grows in complexity:

  • Tight coupling to implementation details. Your agent's behavior is entangled with how it's orchestrated. Changing a model provider means rewriting orchestration code. Adding a new tool means modifying the execution graph.
  • Non-portable definitions. An agent defined as a Python graph in one framework can't be understood by another system. The definition is locked into a specific runtime.
  • Duplicated infrastructure. Every team ends up rebuilding the same primitives: session management, streaming, error recovery, observability. These aren't differentiators — they're table stakes that consume engineering time.
  • Collaboration barriers. When agent behavior is embedded in code, only developers can modify it. Product managers, designers, and domain experts are locked out of the iteration loop.

What Declarative Agent Architecture Means

Declarative agent architecture inverts the relationship between what an agent does and how it's executed. Instead of writing orchestration code, you declare:

  • Agent behavior — the model, system prompt, personality, and capabilities
  • Available tools — what the agent can do, defined as a contract between the platform and your backend
  • Workflows — triggers, handlers, and the sequence of steps that execute when events occur

The platform reads this declaration and handles everything else: model routing, session persistence, streaming, tool execution coordination, and observability. You describe the what; the platform handles the how.

Imperative

You manage orchestration

Define graph nodes
Write state transitions
Handle tool execution
Manage sessions
Set up streaming
Add observability
Wire error handling

Orchestration code often exceeds agent logic

Declarative

You describe the agent

Define agent behavior
Declare available tools
Set up triggers & handlers
Platform handles
Sessions
Streaming
Model routing
Observability

Focus on what matters — your agent's logic

This isn't a new concept in software. Declarative approaches have won in nearly every infrastructure domain:

DomainImperativeDeclarative
DataManual traversalSQL
UIDOM manipulationReact
InfraCloud API callsTerraform
ContainersContainer scriptsKubernetes
AgentsOrchestration codeProtocol

The pattern is always the same — declare intent, let the runtime optimize execution.

Declarative vs Imperative: A Concrete Example

Consider building a customer support agent that can search documentation, create tickets, and escalate to a human. Here's what the imperative approach looks like:

typescript

And the declarative equivalent:

yaml

The declarative version doesn't just look simpler — it is simpler. The routing, state management, streaming, and tool execution are handled by the platform. The model decides when to use tools based on the conversation context, just as it would in any well-designed agent system. But you didn't have to build the infrastructure for it.

Why Declarative Architecture Scales Better

Agent Protocol

Behavior, tools, triggers, handlers

You define

Orchestration Platform

Sessions, streaming, model routing, tracing

Octavus handles

Your Backend

Tool execution on your infrastructure

You implement

Model agnosticism becomes natural

When agent behavior is declared separately from execution, switching models is a configuration change — not a code rewrite. Today your agent uses Claude; tomorrow it uses GPT-4o; next week you run both and compare. The protocol stays the same.

Observability is built-in, not bolted on

Because the platform controls execution, it can trace every step automatically: tool calls, model reasoning, skill invocations, timing data. You don't need a separate observability stack — the platform already knows what happened and why.

Your team can iterate faster

A declarative protocol is readable by anyone on the team. Product managers can review agent behavior. Domain experts can modify system prompts. Engineers focus on building tools and integrations, not maintaining orchestration code.

Tools stay on your infrastructure

In a declarative model, tools are defined as contracts. The platform knows a tool exists and what its schema looks like, but your backend executes it. No sensitive data passes through the orchestration layer — the agent requests a tool call, your server executes it, and the result flows back.

Getting Started with Declarative Agents

Octavus is built around this declarative philosophy. You define your agent in a protocol, implement tools in your backend using the @octavus/server-sdk, and connect your frontend with @octavus/react or the @octavus/client-sdk. The platform handles sessions, streaming, model routing, and observability.

If you're tired of writing orchestration code that doesn't differentiate your product, declarative agent architecture is worth exploring. The shift is similar to moving from jQuery to React, or from shell scripts to Terraform — less control over the how, more focus on the what, and dramatically less code to maintain.

Read the documentation to see how declarative agent development works in practice.