# `GEPA.CodeExecution`
[🔗](https://github.com/nshkrdotcom/gepa_ex/blob/v0.3.0/lib/gepa/code_execution.ex#L42)

Utilities for evaluating Elixir code snippets with captured outputs.

The module keeps the original `execute/2` map-returning API while adding the
upstream-style `execute_code/2` API with timeout support, captured stdout and
stderr, code hashes, variable capture, and optional entry-point invocation.

# `mode`

```elixir
@type mode() :: :in_process | :subprocess
```

# `result`

```elixir
@type result() :: %{
  :ok =&gt; boolean(),
  optional(:result) =&gt; term(),
  optional(:stdout) =&gt; String.t(),
  optional(:stderr) =&gt; String.t(),
  optional(:error) =&gt; term(),
  optional(:bindings) =&gt; keyword()
}
```

# `execute`

```elixir
@spec execute(
  String.t(),
  keyword()
) :: result()
```

Execute Elixir code and return the legacy map result.

# `execute_code`

```elixir
@spec execute_code(
  String.t(),
  keyword()
) :: GEPA.CodeExecution.Result.t()
```

Execute Elixir code and return a rich structured result.

# `get_code_hash`

```elixir
@spec get_code_hash(String.t(), pos_integer()) :: String.t()
```

Return a deterministic hash for normalized source code.

# `side_info_to_data`

```elixir
@spec side_info_to_data(term()) :: term()
```

Convert side-info values into serializable values suitable for prompts.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
