C.W.K.
Stream
Lesson 04 of 06 · published

Agents Are Not an Architecture (and 'Long Context' Isn't Either)

~10 min · agents, context, product

Level 0Scout
0 XP0/41 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Agents — a loop, not a wiring

An "AI agent" is an LLM placed inside a scaffolding loop — observe, think, act, observe again. Every framework you have heard of (LangChain, LangGraph, CrewAI, AutoGen, OpenAI Agents SDK, Claude Agent SDK) is a loop with state management around standard LLM calls. Each iteration is one normal model invocation with a carefully constructed prompt. The model has no awareness it is "in an agent" — it just sees a chat conversation.

The agent loop in pseudocode

If you can implement an agent in 30 lines of orchestration code, the agent is not an architecture. It is plumbing. The model is unchanged.

Long context is not a new architecture

Extending context length from 4K to 128K to 1M+ tokens involves:

  • RoPE frequency scaling (NTK-aware scaling, dynamic NTK, YaRN) — adjusting the rotary position encoding to extrapolate beyond the trained window.
  • Continued training on long sequences with the new RoPE configuration.
  • Better attention implementations for the longer KV-cache.

None of this is a new architecture. The backbone Transformer is unchanged; what changes is the position encoding and the training data length.

Effective context ≠ advertised context

A 1M-token context window does not mean the model uses 1M tokens well. Research like the "Needle in a Haystack" test and various MECW (Maximum Effective Context Window) evaluations show many models degrade significantly long before reaching their advertised limit. The advertised number is a capacity, not a capability.

The general lesson

Anything that wraps a fixed model with extra software — agents, RAG, long context tricks, guardrails, system prompts — is product or training, not architecture. The architectural skeleton is what is encoded in the weights file. Everything else is application code.

Code

An entire agent in 25 lines (no model change)·python
def agent_loop(goal, llm, tools, max_steps=20):
    history = [{"role": "system", "content": f"You are an agent. Goal: {goal}"}]
    for step in range(max_steps):
        response = llm.generate(history)
        history.append({"role": "assistant", "content": response})
        if "FINAL_ANSWER" in response:
            return response
        tool_call = parse_tool_call(response)
        if tool_call is None:
            continue
        result = tools[tool_call["name"]](**tool_call["args"])
        history.append({"role": "tool", "content": str(result)})
    return "STOPPED: max_steps reached"
RoPE frequency scaling — the long-context trick·python
# Standard RoPE (training-time)
def rope_freqs(d_model, base=10000.0):
    return base ** (-torch.arange(0, d_model, 2) / d_model)

# YaRN-style scaling for extension
def yarn_scaled_freqs(d_model, base=10000.0, scale=4.0):
    return base ** (-torch.arange(0, d_model, 2) / d_model) / scale
# Position encoding adjustment, no architectural change.

External links

Exercise

Run the same long-context task (e.g., 'find this fact buried at position 90% in a 100K-token document') against two models with similar advertised context windows. Compare results. The difference is rarely about wiring — it is about how thoroughly each model was trained for long-context recall.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.