What even is agency, amitrite? To me, it has now become this word that I've heard so many times it has lost its meaning as a real word. (Apparently this phenomena is called “verbal satiation”). But I digress. Let's start this off with the definition of agency, which I had to look up to feel confident.
The have agency is to take action and make choices that influence outcomes. To same “something has agency,” means it can decide between options (even if the options are limited), act intentionally, and cause effects in the world.
This can be contrasted with just waiting for things to happen. In my classes I use the metaphor of being proactive (agentic) as opposed to reactive (assistive). Responding to a request as opposed to proactively pursuing an objective. Having spend a lot of time in the last quarter building and deploying agents, here are some key concepts that may be useful for you on your journey to create agents that actually have agency.
Agency = Context + Planning + Memory + Tools + Action + Adaptivity
Context
Context engineering is the discipline of deliberately designing, assembling, and managing everything an AI model sees before it responds. You can think of it as the fuller realization of what started out as prompt engineering. Prompt engineering is what you say, context engineering is what the model knows, remembers, assumes, is constrained by, and is allowed to do at any moment. Yeah, it's kind of a Big Deal.
Consider an agent whose scope it to correct misapplied payments and waive late fees, when appropriate. "Context" in this use case might include:
- Information about the loan from the system or systems that have it including prior payment data from the servicing system.
- Information the customer might provide about what happened expressed as a complaint or inquiry.
- The specific circumstances around the one payment in question (i.e. "the facts").
- The rules (constraints) about what has to happen to a payment when it's received.
- The last few things that happened and the new few things that are expected to happen.
- The specific span of control the agent has (what is it actually allowed to do).
All of this has to be engineered and cared for. The systems have to be known and able to be integrated with. The data has to be high quality and consistent, and conditions for bad data understood and designed into the workflow. From a testing perspective, we have to know the conditions we should expect, and also plan for the conditions we failed to anticipate.
Let's talk about data. The data informs the prompts informs the data. Rich data requires rich prompts, when the prompts don't "match" the data, we can get really bad results. When I set up a test harness for my agent, I have to have a good set of realistic data because I can assure you, the agent will find all the little warts and holes and the agents plan will have that bad conext baked right in. I find that I engineer the data over time as my understanding evolves. Then I revise the prompts. Then I learn new things about the data. Then I revise the prompts.... You get the idea.
Agents do stupid shit sometimes. Context engineering helps to improve the judgement of the agent to do less stupid shit less frequently.
Planning
On its surface, this is relatively straightforward - use a large language model (LLM) to make a plan to solve the problem. There is another aspect to planning, however, which is the actual orchestration of the workflow, knowing when to call tools, knowing when to call deterministic functions, and knowing the scope. In the context of our example, planning might include:
- What information is required before we can make the specific interaction plan to correct a misapplied payment and handle the associated late fee.
- An overall flow for handling this specific type of problem - classify problem at sayment related, verify identity of specific borrower, gather additional payment history data.
- The specific plan for the actual interaction - determine correct application of funds, apply funds, determine what to do with late fee, make recommendation to human in the loop.
- Take specific set of action steps to resolve problem.
So there are multiple aspects to planning - workflow orchestration (which may be a combination of deterministic and probabilistic steps), the actual recommended plan, the validated plan, and the resolution plan.
Memory
It's funny to come from a field where we have sought after statelessness for so long. Not to get too technical, as I am already way over my skis talking about things I don't understand well, but service-based architectures (the wave before now) was all about resiliency and moving away from monoliths. The idea that we can have one part of the system break, and the rest of the system stay in tact.
A stateless service tends to scale well, fail predictably, be easier to understand, and minimizes coordination complexity. This is helpful for us mere mortals. So where did the state actually go? It went into databases, event logs, workflow engines, and... humans. We had state, it was just distributed. Now we have this whole new way of making systems (the agentic way), and the key distinction is understanding and evolving state. And this is one of the critical parts of memory.
Back to our example of the agent that corrects misapplied payments and waives late fees. What does memory mean? It means:
- We know what came before, the payments that were made, the fact that there was or was not a late fee applied.
- We know what happened in the initial interaction, why the customer contacted us, the channel, how they "usually" interact, whether they were frustrated.
- We understand the original plan and the adapted plan based on the feedback from the human in the loop. Perhaps the original plan waived the late fee and the HITL overrode that and ultimately the agent did not waive the fee.
- The next time this consumer contacts or there is another "related" situation, the agent knows about the misapplied payment that happened in this event context.
So memory can be short term, long term, in the interaction, apart from the interaction, and can apply to the future or not. For those of you using Claude Code, this is a critical part of why Claude "compacts conversations". This is taking a cet of context that is too large or inefficient to pass each time and keep "in memory" that is subsequently compacted for continuous use. That compacted context is not typically available int he next session unless it is stored elsewhere, which is a conversation for another article.
Tools
Looking at Claude Code, there are hundreds if not thousands of tools. Claude gives you clues to this when it is thinking as it notes the number of tools it used in a particular step. i've started to pay attention to this. Tools are just what they sound like - a tool is any capability the agent can call to do something in the world beyond just generating text.
In our example context, tools might be:
- Get payment history.
- Generate summary for human in the loop.
- Waive late fee.
- Store document.
- Create customer notification.
There can be lots and lots of tools, but keep in mind that the more tools there are, the more ways there are that things can do sideways with your agent. Yes, claude code has hundreds or thousands of tools. Anthropic's overall post-money valuation was reported at $183B in September 2025. It's safe to say they have way more money and talent to develop Claude Code that we do for whatever agents we are creating. Stay humble guys, keep it small and iterate.
Adaptivity
Two types of adaptation we are talking about here - adapting to environmental changes (new data being a big one) and adapting the human in the loop (HITL). I might also throw in adapting to predefined stopping points - sometimes called "stop hooks" - although that's not really adaptation, that's just executive a plan when a set of plan conditions are met. In any event, adapting to the environment and new or changed context is a critical part of agency. Something changes, and I need to change - I had a plan, now I need to make a new plan. On my own. Without being asked. Or, I need to stop and check in to make a new plan (this is a stop hook).
And then there is human-in-the-loop (HITL) adaptivity. Making a plan, having tools, and executing a plan is really meaningless if it's the wrong plan. In fact, it's worse than meaningless, it can be actually destructive and create harm for humans. Yes we want to provide good context engineering to prevent the wrong plan from being executed, and also, especially in mortgage, we will continue to have humans in the loop for many use cases for many years.
In our example, we might adapt to:
- New information - another payment comes in, a check bounces, we receive a bankruptcy notification.
- Changed information - turns out the loan type is actually different than what we thought, changing the rules for what we have to do.
- Human policy latitude - maybe the system says we shouldn't waive the late fee but in fact the human authority makes a different decision. We will, therefore, need to take a different set of actions (make and execute a new plan).
And it goes on an on. I find the best way to really see all this in action is to, well, make it happen. I encourage each of you to create your own agent, or reach out to me and I'd be happy to help you get started on your journey. And naturally, feel free to work with various partners in the industry (including us and the Phoenix Burst team) who already have agents available to do useful things in mortgage.
If you are looking for education, the Mortgage Bankers Association training calendar for AI is already up on their website, and we will be focusing a lot more on agents this year. Hope to see you in a class sometime soon. Happy building!