> For the complete documentation index, see [llms.txt](https://docs.contextual.io/documentation-and-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/types-of-agents/event-to-flow.md).

# Event to Flow

**Event to Flow** agents receive asynchronous events and use the configured flow to process the event. For this type of agent, the flow must contain at least one "Event Start" node and one or more "Event End" and/or "Event Error" nodes.

**Event Start Nodes** — The event start node in a flow is considered an "entry point" in the flow where the execution of the event begins. A single flow can actually have multiple event start nodes, and the agent itself it configured to tell the runtime which event start node should be used for that specific agent.

**Event End Nodes** — Because Contextual flows can process events asynchronously within the flow itself, they have the ability to handle multiple data streams through the same logic concurrently, or to branch off and process the same data in various ways at the same time.

Given this capability, it is crucial that these flows include a clearly defined "Event End" node. This "Event End" node indicates to the runtime environment that the flow execution has been completed. This ensures that all processing paths within the flow are properly terminated and that resources are efficiently managed.

**Event Error Nodes —** Similarly, an "Event Error" node signals that an error has occurred in the processing of the flow. Like the Event End node, the Event Error node also terminates the execution of the flow. However when a flow terminates on an Event Error node, the logs for the execution of the flow are categories as an "error" so that they can be easily found and analyzed.

**Scale to Zero —** Available to Event to Flow agents using Event Lag (lag-based) scaling, on tenant plans that support parallel instance scaling. Configure it by setting Minimum Instances to 0 and Maximum Instances to at least 1.

When the agent has no work to process, the platform can reduce its running instances to zero. When new events arrive, processing waits while an instance starts. Startup time varies with agent size, image, and current load, and is not a fixed duration.

See [Parallel Instances](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/scale-and-performance/parallel-instances) for full configuration guidance and tradeoffs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.contextual.io/documentation-and-resources/components-and-data/agents/types-of-agents/event-to-flow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
