> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contextual.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Input Mapping

> Connect nodes together in Agent Composer workflows

## Description

Input mapping defines how nodes connect to each other in an Agent Composer workflow. It specifies which outputs from previous nodes flow into the inputs of subsequent nodes.

## Syntax

Input mappings use the syntax `source_node#output_key`:

```yaml theme={null}
input_mapping:
  current_node_input: earlier_node#output_key
```

This connects the `output_key` output from `earlier_node` to the `current_node_input` input of the current node.

## Accessing Graph Inputs

Every graph has an implicit input node named `__inputs__`. Access graph-level inputs via:

```yaml theme={null}
input_mapping:
  query: __inputs__#query
```

## Example

```yaml theme={null}
nodes:
  # First node receives input from the graph
  search:
    type: SearchUnstructuredDataStep
    input_mapping:
      query: __inputs__#query

  # Second node receives input from the first node
  rerank:
    type: RerankRetrievalsStep
    input_mapping:
      query: __inputs__#query
      retrievals: search#retrievals

  # Third node receives inputs from multiple nodes
  generate:
    type: ResponseGenerationStep
    input_mapping:
      query: __inputs__#query
      retrievals: rerank#retrievals

  # Output node collects final outputs
  __outputs__:
    type: output
    input_mapping:
      response: generate#response
```

## Rules

* All inputs of a node must be connected
* Unused outputs are allowed
* A node can receive inputs from multiple source nodes
* The same output can be connected to multiple downstream nodes

## Multiple Inputs from Same Source

You can connect multiple inputs from the same source node:

```yaml theme={null}
generate:
  type: ResponseGenerationStep
  input_mapping:
    query: __inputs__#query
    retrievals: search#retrievals
    translate_needed: translate#translate_needed
    detected_language: translate#detected_language
```

## Related

* [YAML Format](/reference/ac-yaml-format)
* [Config Overrides](/reference/ac-config-overrides)
