# Long Horizon Agents

By [Om Labs](https://blog.usejina.com), 2026-10-27

ai-agents, long-horizon-systems, orchestration

---

Originally published by [Om Labs](https://omlabs.xyz/blog/agents-that-decide-what-to-do-next).

> Long-horizon agents differ from task agents because they retain a goal over time, use new signals to update their context, and autonomously decide which task to execute next.

Most agents today wait for a task.

You ask them to review a pull request, research a market, or implement a feature. They finish the work, return a result, and stop.

Long horizon agents keep ownership of a goal over days, weeks, or months.

They share context, watch for new signals, and decide which tasks to execute next. Every result updates their understanding of the goal and changes what they do after.

Two examples
------------

Give an agent the goal: **increase activation without increasing support load**.

It reads product events, support conversations, and past experiments. It decides to interview churned users. The interviews point to a slow setup flow, so it runs an onboarding experiment. Support tickets go up, so it changes the experiment and watches again.

Or give an agent the goal: **keep gross margin above 80% while latency stays below 300ms**.

It sees an inference cost spike and traces it to one customer workflow. It runs a cache experiment, watches latency after rollout, and decides whether to expand or revert the change.

The output is better margin and stable latency. The work required to get there can change every week.

Task agents
-----------

[Codex](https://developers.openai.com/codex/) and [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) are task agents.

You can say: “Implement usage based billing.”

The agent explores the codebase, makes a plan, opens subagents, writes code, runs tests, repairs failures, and returns a result.

The request defines the work and the end of the run.

  
![A coding task starts one bounded agent run. The agent can delegate the work, but it stops when the task is complete.](https://usejina.com/blog/paragraph-diagrams/task-agent.png)

Agents can also run in loops.

A pull request triggers a review agent. Monday morning triggers a reporting agent. An error threshold triggers a triage agent.

These loops are useful. The trigger and task are configured in advance.

  
![A configured signal starts the same bounded task each time. The agent handles the event and waits for the next trigger.](https://usejina.com/blog/paragraph-diagrams/trigger-loop.png)

Three axes that actually differ
-------------------------------

Axis

Task agent

Trigger loop

Long horizon agents

**Who decides the next action**

Person

Configured trigger

Agent

**Context**

One run

Limited per run

Accumulates across the goal

**Termination condition**

Task complete

Event handled

Goal achieved or stopped by a guardrail

Long horizon agents
-------------------

Long horizon agents start with context built for a specific goal.

The context engine is the glue that ties the system together. It can include SOPs, context graphs, wikis, previous decisions, past work, and live signals.

It carries history and memory across tasks, so the orchestrator and every task it creates know what has already been done and can use that context when relevant.

  
![A context engine guides an orchestrator as signals become tasks and task results become new signals.](https://usejina.com/blog/paragraph-diagrams/long-horizon.png)

*   **Context engine:** carries shared knowledge, history, and memory across tasks.
    
*   **Signal:** reports an external change or the result of a completed task.
    
*   **Orchestrator:** reads the context and decides what should happen next.
    
*   **Task queue:** holds the work chosen by the orchestrator.
    

When a task finishes, its result becomes a new signal. The orchestrator reads it, updates the plan, and decides what enters the queue next.

A good result becomes memory. A bad result changes the plan. An external signal can move ahead of the existing queue.

The agent gets a bounded objective, explicit permissions, budgets, approval thresholds, and an audit trail. It owns the next decision inside those guardrails.

Jina as the maintenance layer
-----------------------------

Our fundamental belief behind [Jina](https://www.usejina.com/) is that the bottleneck in software engineering has shifted from coding to resilience.

Coding agents can ship more changes than teams can review, test, and monitor.

Jina starts with a wiki built for QA and maintenance. It captures architectural diagrams, dependencies, operating procedures, issue history, and what correct behavior looks like.

A context graph connects that knowledge to the code, infrastructure, and runtime behavior. Jina uses it to review each pull request, plan the blast radius, and run the relevant parts of the app.

A pull request is one signal in a longer maintenance system.

Say an OAuth pull request opens. That signal calls Jina’s orchestrator, which adds a targeted review to the work queue.

The review finds that a PKCE check can be bypassed. That issue returns to the orchestrator as a new signal.

The orchestrator adds a deeper auth review and a production monitor.

Days later, the monitor sees callback failures rise. It calls the orchestrator, which adds a review of the related code, ships a fix, and adds a new monitor for refresh token rotation.

  
![Jina turns a pull request into a review, uses the findings to create deeper reviews and production monitors, then uses runtime issues to review related code, ship a fix, and add new monitors.](https://usejina.com/blog/paragraph-diagrams/jina-maintenance.png)

Jina decided each task from the result of the task before it.

That is our vision for autonomous maintenance.

Jina keeps watching, deciding, and fixing until the system is healthy.

---

*Originally published on [Om Labs](https://blog.usejina.com/agents-that-decide-what-to-do-next)*
