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

# Inputs and Outputs

> Choose automatic Channel conversion or explicit adapters.

GroundForge Channel jobs and LangChain Agent state do not always have the same shape. The SDK offers two approaches.

## Automatic mode

Use automatic mode when the Agent accepts normal message state and returns a normal final assistant message:

```python theme={null}
init_groundforge(
    agent=agent,
    params={"channelInputMode": "auto"},
    # connection values omitted
)
```

The [LangChain Agent Example](/examples/langchain-agent) uses this approach.

## Input adapter

Use an input adapter when your Agent expects a custom state object. A Channel job contains normalized request text in `job["input"]`:

```python theme={null}
def input_adapter(job):
    text = str(job.get("input") or "").strip()
    return {
        "messages": [
            {"role": "user", "content": text}
        ]
    }
```

Do not assume application metadata such as a user ID is present. Read only the fields your actual Channel job supplies.

## Output adapter

Use an output adapter when the Agent returns a custom result:

```python theme={null}
def output_adapter(result):
    final_message = result["messages"][-1]
    return {"text": final_message.content}
```

Pass both adapters to `init_groundforge()`:

```python theme={null}
init_groundforge(
    agent=agent,
    input_adapter=input_adapter,
    output_adapter=output_adapter,
    # connection values omitted
)
```

See the complete [LangChain Agent with Adapters](/examples/langchain-adapter) walkthrough.

## Example

Compare [LangChain Agent Example](/examples/langchain-agent) with [LangChain Agent with Adapters](/examples/langchain-adapter). The adapter page uses only the normalized `job["input"]` field.


## Related topics

- [LangChain Agent with Adapters](/examples/langchain-adapter.md)
- [Security](/help/security.md)
- [Configuration](/sdk/configuration.md)
- [Govern the Weather Capability](/guides/tool-governance.md)
