# Agents

An agent is a program that decides what to do next by calling a model in a loop. On Flyte, each step of that loop is a task, which is what makes the agent durable: every model call, tool call, and intermediate result is recorded, so a run that fails partway through can be inspected and resumed rather than restarted.

This matters more for agents than for batch jobs. An agent's control flow is decided at runtime by the model, so you cannot know in advance which path a run took. Recording each step is what makes the run explainable afterward.

```python
@env.task
def step(state: State) -> State:
    ...  # one model call plus its tool calls
```

Nothing here is a separate agent framework. An agent is tasks for the reasoning steps, an app when it needs to be reachable over HTTP, and a sandbox when it executes code the model wrote.

### [Build an agent](https://www.union.ai/docs/latest/flyte/user-guide/agents/build-agent/page.md)

Implement ReAct, Plan-and-Execute, and other agent patterns with full observability.

### [Build an MCP](https://www.union.ai/docs/latest/flyte/user-guide/agents/build-mcp/page.md)

Serve Model Context Protocol servers for AI assistants to interact with, hosted on Flyte.

### [Sandboxing](https://www.union.ai/docs/latest/flyte/user-guide/agents/sandboxing/page.md)

Safely execute LLM-generated code with workflow sandboxes or ephemeral containers.

## Related

### [Agent frameworks](https://www.union.ai/docs/latest/flyte/integrations/agents/page.md)

Run agents from OpenAI, Claude, LangGraph, CrewAI, and more as durable Flyte tasks.

### [Tasks](https://www.union.ai/docs/latest/flyte/user-guide/tasks/page.md)

The unit each reasoning step is built from.

## Subpages

- [Build an agent](https://www.union.ai/docs/latest/flyte/user-guide/agents/build-agent/page.md)
  - How Flyte maps to the agentic world
  - Ways to build an agent
  - Deploying an agent
  - Related
- [Build an MCP](https://www.union.ai/docs/latest/flyte/user-guide/agents/build-mcp/page.md)
  - HTTP layout
  - Quickstart
- [Sandboxing](https://www.union.ai/docs/latest/flyte/user-guide/agents/sandboxing/page.md)
  - Why sandboxing matters for AI
  - Types of sandboxes
  - What Flyte offers
  - Workflow sandbox (Monty)
  - Code sandbox (container)
  - When to use which
  - Learn more

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/user-guide/agents/_index.md
**HTML**: https://www.union.ai/docs/latest/flyte/user-guide/agents/
