> For the complete documentation index, see [llms.txt](https://docs.fastn.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastn.ai/flow-setup-essentials/designing-a-flow/custom-code.md).

# Custom Code

Write your own logic inside the flow using supported programming languages such as **JavaScript, Python Lambda, or C#**. This step is useful when you need more control, advanced data handling, or custom logic that cannot be achieved with standard components.

<figure><img src="https://docs.fastn.ai/~gitbook/image?url=https%3A%2F%2F1255842839-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F3iSr2Tx8FvvuoLPncziH%252Fuploads%252FW4LojehxvRb903r8X4XV%252Fimage.png%3Falt%3Dmedia%26token%3D35c52fa1-8758-4672-a870-f2f2d5d760ed&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=20a0254c&#x26;sv=2" alt="Custom Code component in the flow editor with language selection options"><figcaption></figcaption></figure>

**Example (C# Custom Code)**

For example, if you need to add a **Custom Code** step in your flow, you can write a function that processes the data coming from previous steps and returns the output you want to use later. In the example below, the function is written in **C#**.

It takes the flow data as input, extracts the `steps` object (which contains outputs from earlier steps), deserializes it into a dictionary, and then returns it. This allows you to handle the step data programmatically inside your flow and make it available for the next steps.

> This example shows how you can configure the **Custom Code** step in **C#**, but the same component also works with **JavaScript** or **Python Lambda**, depending on your preference.

<figure><img src="https://docs.fastn.ai/~gitbook/image?url=https%3A%2F%2F1255842839-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F3iSr2Tx8FvvuoLPncziH%252Fuploads%252FiI3cHs5kUxWWn0JSLuW6%252Fimage.png%3Falt%3Dmedia%26token%3Df887a3fd-02a4-4815-ae2e-959919ecf544&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=21e60540&#x26;sv=2" alt="Example C# custom code step processing flow data and deserializing step outputs"><figcaption></figcaption></figure>

{% hint style="info" %}
To make this easier, the AI agent in the top right corner provides smart suggestions about the code.
{% endhint %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fastn.ai/flow-setup-essentials/designing-a-flow/custom-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
