Declarative Intent
Describe what you want, not how to do it.
"The best code is the code you don't write."
Nika's YAML-first design means you declare your intentions — the prompts, the tools, the flows. The engine handles parallelization, error recovery, and optimization automatically.
Imperative vs Declarative
from langchain import Agent, Chain
from langchain.tools import Tool
import asyncio
async def run_workflow():
# Initialize clients
client = AnthropicClient()
# Create tools
read_tool = Tool(...)
grep_tool = Tool(...)
# Create agents
analyzer = Agent(
model="claude-sonnet",
tools=[read_tool, grep_tool],
max_iterations=10,
)
# Handle errors manually
try:
result = await analyzer.run(...)
except TimeoutError:
# Fallback logic
result = await backup_agent.run(...)
except RateLimitError:
# Retry logic
await asyncio.sleep(60)
result = await analyzer.run(...)
# ... 400 more lines ...agent:
model: claude-sonnet-4-5
systemPrompt: "You analyze code."
tasks:
- id: analyze
agent:
prompt: "Analyze codebase"
tools: [Read, Grep]
maxTurns: 10
timeout: 30000
- id: report
agent:
prompt: "Generate report"
tools: [Write]
flows:
- source: analyze
target: report
# That's it. Error handling,
# retries, parallelization —
# all handled automatically.Research Backing: According to a 2024 ArXiv study on declarative AI orchestration, declarative approaches achieve 89% task success vs 78% for imperative, with 60% less development time and 85% better error handling. Source
The Numbers Don't Lie
| Aspect | Declarative (Nika) | Imperative (SDK) |
|---|---|---|
| Focus | What outcome you want | How to achieve it step-by-step |
| Code Volume | < 50 lines YAML | 500+ lines Python |
| Dev Time | ~16 hours (60% less) | ~48 hours |
| Modifiability | Non-engineers can edit | Requires developers |
| Error Handling | Framework handles 85% automatically | Manual try/catch everywhere |
| Version Control | Git-friendly, diff-able | Complex merge conflicts |
Four Pillars of Declarative Design
Outcome-Focused
Define the result you want, not the algorithm to get there. The engine optimizes execution.
Self-Describing
Workflows are documentation. Read the YAML, understand the system. No code diving required.
Composable
Small, single-purpose tasks combine into complex workflows. Reuse across projects.
Reproducible
Same YAML, same execution, same results. Deterministic by design.
Implementation Status
Declarative intent is Nika's core philosophy, fully implemented:
- YAML-first workflow definition — Implemented
- 5 semantic verbs (agent, exec, fetch, invoke, infer) — Implemented
- DAG-based automatic parallelization — Implemented
- Flow definitions with merge strategies — Implemented