# `Codex.Agent`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.16.1/lib/codex/agent.ex#L1)

Defines a reusable agent with instructions, tools, and hooks.

# `t`

```elixir
@type t() :: %Codex.Agent{
  handoff_description: String.t() | nil,
  handoffs: list(),
  hooks: term(),
  input_guardrails: list(),
  instructions: String.t() | nil,
  model: String.t() | nil,
  model_settings: map() | struct() | nil,
  name: String.t() | nil,
  output_guardrails: list(),
  prompt: map() | String.t() | nil,
  reset_tool_choice: boolean(),
  tool_input_guardrails: list(),
  tool_output_guardrails: list(),
  tool_use_behavior:
    :run_llm_again
    | :stop_on_first_tool
    | %{optional(:stop_at_tool_names) =&gt; [String.t()]}
    | function()
    | nil,
  tools: list()
}
```

# `new`

```elixir
@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}
```

Builds a validated `%Codex.Agent{}` struct.

---

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