# Agent Workflows

> Use these patterns to structure agent prompts, tool sequencing, and human review loops for Lev-backed workflows.

Source: https://www.lev.com/docs/build/agent-workflows

Last updated: May 2026

---
## Workflow Design Principles

- **Retrieve before acting**: pull deals, placements, term sheets, and account context before the agent makes a recommendation.
- **Keep tools narrow**: prefer smaller reads and explicit actions over one giant prompt that asks the model to infer missing state.
- **Make handoffs visible**: when the agent wants to mutate data or message a human, show the exact reasoning and source records first.
- **Use resource pages as contracts**: tie prompt instructions to the schemas and constraints in the API reference pages.

## Recommended Tool Flow

Resolve the deal, account, or lender the user is talking about before asking the model to reason about next steps.

Read the smallest set of records needed: deal, financials, placements, term sheets, or team context.

Have the agent restate the key facts before it proposes any write or outbound action.

For writes or external actions, require an explicit user confirmation or a review checkpoint.

Perform the bounded action, then return the updated state plus the `request_id` when relevant.

## Prompt Patterns

**Prompt templates**

### Read-first workflow

```markdown
You are helping a broker evaluate a deal.

1. Read the deal, deal financials, placements, and term sheets.
2. Summarize the facts you found.
3. Recommend the next action only if the records are sufficient.
4. If data is missing, say exactly what to fetch next.
```

### Human approval step

```markdown
Before making any write:

- Show the exact target resource.
- Show the fields that would change.
- Ask for confirmation in plain language.
- If the user does not confirm, stop.
```

## Safety and Review

  An agent that exposes its retrieved records, next action, and exact write payload is more useful than an agent that tries to feel magical.

- Keep outbound actions gated behind approval.
- Treat placements and term-sheet comparisons as high-value review checkpoints.
- Use `request_id` values from the API when you need to trace surprising behavior.