Blog
Engineering
Inside Agent Automations
How Cogent build asynchronous, long-running agent loops and workflows.
9min read

In our previous post on DefenseOS, we described how Cogent brings together the context agents need and the runtime they use to carry out security work. Agent Automations is a key component: teams define workflows in natural language, and agents carry them out in the background. Events, time-based triggers, and manual runs initiate work or bring agents back to an ongoing task, so the workflow can continue without someone prompting each step.
Here, we’ll look at the design choices behind those automations. We’ll cover how key system components, including our Event Plane and trigger engine, work together, how we configure agents and their harnesses, and how asynchronous orchestration and memory let an investigation continue across worker assignments and runs. We’ll also explain why we’re building on the same framework for our own engineering workflows, and why we think that matters for anyone building an agent platform.
Asynchronous agents make ongoing automation practical
Over the past couple of years, a common way to build an agent has been a synchronous ReAct-style loop: the model reasons about the task, calls a tool, waits for the result, and uses it to decide what to do next. The tool might query a database, run a command, or delegate to a sub-agent. In this setup, even a delegated task holds up the parent loop until it returns.
More recently, agent systems have started to move toward asynchronous orchestration. OpenAI’s dots and DeepSeek’s super-agent are examples of this shift, where a main agent delegates longer assignments to background workers and receives their results later.
These are variations on the same orchestration-and-worker pattern: an orchestrator coordinates the task while workers run their own agent loops and report back as they finish. More capable models have made this approach practical, sustaining work over longer horizons, coordinating multiple workers, and their memory as the task progresses.
At Cogent, we’re applying this pattern with native support in our agent harness, which powers our interactive chat and background automation products. A manual run, schedule, or event starts the work. From there, the orchestrator can assign workers, wait for results or new evidence, and decide what to do next without someone prompting each step. While it waits, the orchestrator can remain idle. Events from registered listeners or worker results can arrive in the inbox and wake the agent for its next turn.
Figure 1. A synchronous loop holds the parent open while a sub-agent runs. An asynchronous orchestrator assigns work, stays idle, and takes a short turn whenever a result or event reaches its inbox.
Throughout this post, we’ll use a zero-day automation as a practical example. Available in early access today, this feature lets users configure agent automations to triage events from Cogent’s Zero Day Response. We’ll follow one of those events through the system, starting with how it reaches the automation.
Events determine when work begins
An automation can start with a manual run, a cron schedule, or an event. Event-based triggers become especially useful as the platform takes on more ongoing work: a pipeline publishes a new advisory, an integration reports a change, or a web hook brings in input from another system.
We separate the delivery path into three stages. Our event plane carries events between services using Kafka. The trigger engine evaluates which subscriptions match. The session inbox holds input that has been delivered to an agent. Distinct interfaces let each component evolve independently while working together as part of the same delivery path.
For our zero-day example, a trigger might require a high risk score and at least one affected asset. Matching those conditions establishes that the event warrants the automation’s attention. The agent then decides what investigation is useful.
A trigger combines an event type, conditions, and a destination:
A matching trigger can start an automation run or deliver input to an existing session. In the latter case, events can accumulate in the inbox and be handled together on the next turn. Manual starts and schedules also feed execution, though they do not all travel through the same transport path as an external web hook.
Figure 2. Platform events pass through Event Plane and trigger matching before starting an automation or reaching a session inbox. Manual runs and schedules can start work separately. Agents can register listeners for later events, and worker results return to the inbox for the next turn.
New event sources plug into this same path. An integration supplies the fields available for matching, and the trigger engine uses them to evaluate subscriptions and route events. That lets us add sources without changing how the agent receives and handles its input.
Agents can also use events MCP to choose what future input they want. The tools let an agent discover available event types, create a filtered listener, or schedule a message for later. An agent might listen for an update to an affected asset or schedule a message to reassess an investigation in an hour. Both target the session inbox and can wake an idle agent.
Configuration
For the zero-day automation, we need to give the agent an investigation task, access to the relevant security tools, and instructions for handling the evidence it finds. We define each automation in a schema that specifies how its work should run.
The definition brings together:
Task and inputs: the instructions, expected input, and identity under which the work executes.
Session behavior: whether a trigger starts a new conversation or continues an existing one.
Orchestrator: optional coordination instructions and agent configuration.
Worker: its model, MCP tools, skills, and execution harness.
Session reuse and orchestration are independent choices. One agent can carry out a task directly, without an orchestrator. Either way, the automation can start a fresh conversation for an independent investigation or continue an existing session so later updates arrive alongside the work already done. For an ongoing zero-day investigation, that continuity helps the agent evaluate new evidence in context.
We give the orchestrator tools to receive events, delegate work, and review results. Each worker gets the tools and instructions for its assignment, such as querying asset data to check exposure or researching mitigation options. Configuring them separately keeps specialized tools with the workers that use them, while the orchestrator focuses on coordinating the overall task.
Figure 4. An automation supplies the task and session behavior, with separate configuration for the orchestrator and its workers. The orchestrator can dispatch multiple workers, each using Claude Code, ADP SDK, or Codex, and receive their results through its inbox.
Reusable agent configurations provide a starting set of models, tools, and skills. An automation can inherit those defaults and override the settings its task needs. For example, an exposure worker gets asset data access, while a coding worker gets repository tools and development skills. The orchestrator keeps its own focused tool set.
We also choose the worker’s harness in the configuration. The same coordination model can delegate to a worker running Claude Code or Codex, with native ADP workers included in the broader design. Here are the relevant settings for a zero-day investigation using a Codex worker:
Here, orchestrator.instruction guides the coordinating agent, while the top-level instruction supplies the worker’s task. The worker’s agent_config selects Codex as its harness and inherits the model, tools, and skills left unspecified. Choosing claude_code instead would change the worker runtime while preserving the task and orchestration setup.
The orchestrator setup
Once an event reaches the session, the orchestrator considers it alongside the automation’s task, previous findings, and work already in progress. It decides whether to update memory, dispatch one or more workers, or take no action because the update adds nothing that needs attention.
For a zero-day investigation, the orchestrator might ask one worker to identify exposed assets while another evaluates mitigation options. Each gets a focused assignment and runs independently, returning evidence that helps the orchestrator decide how to continue the investigation.
The orchestration design includes controls to check progress, stop work, and pause or resume workers. These give the orchestrator room to adjust as evidence arrives.
Figure 5. The orchestration cycle: receive a batch of input, decide what matters, dispatch independent work, and incorporate results. Some input requires only a memory update or no new action.
Worker results return asynchronously to the orchestrator’s inbox. They become input for another turn rather than holding the coordinating turn open until every assignment finishes. The session can then review the result, request more work, or conclude the investigation.
This is also where human direction fits. Someone can inspect an investigation or change its priority while background work continues. But the automation does not depend on someone prompting every next step. Its task and incoming events drive the work forward.
Integrating with our sandboxes and agent sdk
For a worker running Claude Code or Codex, setup begins with our agent sandbox control service. The automation selects a sandbox template and supplies the session identity and runtime settings. ASC uses that template to create or reuse the sandbox, applying its environment defaults and network policy.
The harness then prepares the worker inside that sandbox with its model settings, instructions, skills, and MCP connection. Tool calls go through agent gateway, which checks the worker’s identity and access scopes before routing requests to the appropriate MCP sidecars. This gives workers access to the integrations their assignments need through a shared gateway.
Figure 6. ASC provisions the sandbox from a template and runtime settings. The harness configures the worker, Agent Gateway routes its tool calls to MCP sidecars, and durable storage preserves CLI session files for later continuation.
As the worker runs, the harness saves its CLI conversation and event files to durable storage. Restoring those files lets a later turn resume the session, including when it needs a new sandbox. Results return to the orchestrator’s inbox, where they become input for the next decision.
Memory gives the automation continuity across runs
A conversation contains the history of a session. An automation also needs a working record that can outlive a particular conversation or worker: what has been checked, what the evidence says, which questions remain open, and what should happen next.
We support this through automation memory, backed by files in our Context Engine. Each automation has a dedicated path scoped by its automation ID, with access isolated so one automation cannot read another’s memory.
As workers return findings, the orchestrator updates the automation’s memory with the evidence, decisions, and open questions worth keeping. It maintains that record as the work progresses, revising earlier conclusions when new information arrives.
For the zero-day example, memory might contain references to the assets already examined, links to supporting evidence, a working explanation of exposure, and a mitigation question that still needs verification. A later run can retrieve that compact record and re-check relevant evidence instead of reconstructing the investigation from an entire transcript.
Figure 7. The orchestrator writes findings to an automation-specific file scope through Context Engine, backed by S3. Later runs read those files to continue the work. Filenames shown are illustrative.
Building for customers, and use it ourselves
We are building the same foundations for our own software development. An issue or error event can initiate an engineering investigation, lead to a coding assignment, and return a proposed fix for an engineer to review. The task and tools change, but both workflows need reliable event delivery, useful worker configuration, recovery, and continuity.
Figure 9. Customer and engineering automations run on the same events, configuration, harness, and memory layers.
Using one infrastructure creates a practical feedback loop. Improvements to the harness, tool integrations, and automation lifecycle can benefit both engineering workflows and the customer product. Internal use also gives the people building the platform direct experience of where it is difficult to configure, understand, or recover work.
For an applied AI company building an agent platform, we think that should be part of how the company operates. Our own engineers should use the agents they build, helping us create an automation system we can rely on for our own work and the work our customers entrust to it.






