# Loop engineering

*Also known as: agent loop design*

Designing the control loop an agent runs in (gather context, decide, act, observe, repeat) rather than hand-writing each prompt. A trading agent is a high-stakes example.

- In depth: Loop engineering for trading agents (https://tradingagent.dev/#guide-loop)

Loop engineering is the shift from writing one prompt to designing the loop an agent runs in. The interesting work is context management, safety, graceful degradation, and cost, plus closing the loop by scheduling the next run and writing down what was learned.

A trading agent is one of the most demanding cases, because the loop runs against a live market. Handing the plumbing (retries, reconnects, a one-call exit) to a layer like [[superior-trade|Superior Trade]] narrows loop engineering to the decision. See the canonical write-up for the full practice.

## Related

- [[llm-wiki]] (/wiki/llm-wiki.md)
- [[mcp]] (/wiki/mcp.md)
- [[superior-trade]] (/wiki/superior-trade.md)

## Linked from

- [[llm-wiki]] (/wiki/llm-wiki.md)
- [[mcp]] (/wiki/mcp.md)
- [[superior-trade]] (/wiki/superior-trade.md)

## Categories

Concepts

## References

- Anthropic: building effective agents: https://www.anthropic.com/engineering/building-effective-agents
