Skip to main content

Core concepts overview

Agenite is designed around a few core concepts that work together to enable the creation of powerful and flexible AI agents. Understanding these concepts is key to effectively using the framework.

Agents

The central orchestrators in Agenite, responsible for managing the flow of execution.

Tools

Reusable components that agents can use to perform specific actions or interact with external systems.

LLM

Abstraction layer for interacting with different Language Models consistently.

Providers

Connectors to various Large Language Models (LLMs) like OpenAI, Anthropic, etc.
Each of these concepts is explored in detail in its dedicated page. What makes Agenite unique, however, is not just these individual components, but how they work together through an innovative architecture based on JavaScript generators.

Architectural foundation: generators and bidirectional flow

Agenite’s core architecture is built upon modern JavaScript features, primarily Async Generators. This design choice enables a flexible, controllable, and efficient execution flow for AI agents that is particularly well-suited for:
  • Handling asynchronous operations
  • Processing streaming data from LLMs
  • Supporting complex interactions like Human-in-the-Loop (HITL)
  • Providing fine-grained control over agent execution

How generators power the Agenite experience

At the heart of Agenite, an agent’s execution is managed by an Async Generator. When you call the agent.iterate() method, it doesn’t run the whole process at once but returns an AsyncGenerator object that represents the agent’s step-by-step execution plan.
This generator-based approach provides three key capabilities:
  1. Pausable execution: Generators can be paused (yield) and resumed (next()), allowing Agenite to yield control at meaningful points: during LLM calls, tool calls, or while streaming responses.
  2. Step-based progression: Agenite agents operate in discrete Steps (like agenite.llm-call, agenite.tool-call), with each step’s execute method often implemented as an AsyncGenerator. The main agent generator uses yield* to delegate control to the current step’s generator.
  3. Bidirectional communication: The yield statement isn’t just a pause mechanism—it enables two-way communication between the agent and your application code.

Bidirectional communication in action

A crucial feature of generators is their bidirectional nature:
  • When the generator pauses with yield, it sends out a value (like an event describing the current state)
  • When your code resumes the generator with generator.next(value), it can pass a value back into the generator
This bidirectional flow enables powerful patterns:
  • Tool execution: The agent can request a tool to be executed by yielding a tool call event, and your code can send the results back by passing them to next()
  • Human input: The agent can pause to wait for human feedback and continue once it’s provided
  • Middleware: Custom middleware can intercept and transform both the outgoing events and incoming responses
Here’s a simple example that demonstrates this bidirectional flow:
In Agenite, this pattern is used extensively to handle tool calls, process LLM streaming responses, and enable human-in-the-loop interactions.

The agent execution flow

The following sequence diagram illustrates how the different components of Agenite interact during agent execution: This diagram shows the interplay between:
  • Your application code that drives the agent
  • The agent generator that orchestrates the execution
  • Individual step executors that handle specific tasks
  • External systems like LLMs and tools

Practical examples

Basic agent execution loop

Here’s a practical example of how you might implement a basic execution loop for an Agenite agent:

Human-in-the-loop integration

The generator architecture naturally supports human-in-the-loop scenarios. Here’s how you might implement a confirmation step:

Benefits of Agenite’s architecture

Agenite’s generator-based, bidirectional architecture provides several key advantages:
  • Fine-grained control: Pause, inspect, and inject data at any point in the execution flow
  • Clear observability: Monitor the agent’s progress through yielded events
  • Natural streaming: Process streaming data from LLMs in real-time
  • Seamless extensibility: Add custom middleware or steps without modifying core code
  • Human-in-the-loop capability: Easily integrate human judgment points into your agent workflows
  • Testability: Precisely control and test the agent’s execution flow
Understanding this architecture is key to unlocking Agenite’s full potential for building sophisticated, interactive, and observable AI agents.