Inversion of Control (IoC) is a software design principle in which the framework or runtime, rather than the application's own code, controls the flow of execution and the wiring of dependencies. It is most commonly realized through dependency injection and IoC containers that supply objects with the collaborators they need.
Inversion Of Control
Inversion of Control (IoC) is a design principle that flips the usual direction of control in a program: instead of your code calling into reusable libraries when it decides to, a framework or runtime calls into your code and takes responsibility for assembling and running it. It is the idea behind the “Hollywood Principle” — don’t call us, we’ll call you — and it is what makes frameworks, plugin systems, and dependency injection possible.
- Dependency injection - The most common form of IoC, where an object receives its collaborators from the outside rather than constructing them itself.
- IoC containers - Runtime components that manage object lifecycles and wire dependencies together based on configuration or convention.
- Framework-driven flow - The framework owns the main execution loop and invokes your handlers, callbacks, or components at the right moments.
- Loose coupling and testability - Because dependencies are supplied externally, components can be swapped, mocked, and tested in isolation.
In API and service development, inversion of control is the backbone of nearly every modern web framework — routing, middleware, and request handlers are all invoked by the framework rather than by application code. This same pattern extends naturally to the agentic turn, where an orchestrator or agent runtime holds the control loop and injects tools, capabilities, and context into the units of logic it decides to invoke.