Introduction to agere: A Lightweight, Fully Customizable Agent Framework
agere is a lightweight, dependency‑free Python framework that lets developers build fully customizable agents by defining reusable Job and handler task nodes in an edge‑node model, supporting parallel execution, fine‑grained callbacks, direct parameter passing, and hierarchical orchestration through a root Commander node.
agere is an open‑source, lightweight agent framework whose main features are generality and full customizability. It simplifies the construction of agents with complex logic by breaking a complex process into a series of independent small steps.
The name comes from the Latin word for “agent”, often translated as “action” or “to do”, implying “driving” or “making something happen”.
agere has no third‑party dependencies and can be installed simply with:
pip install agereIt uses Job and handler as the basic task node types. By defining a Job class and a handler function or method, you can split an agent into reusable nodes. Within a Job you can submit new Jobs, call handlers, and handlers can also invoke other handlers or submit Jobs.
Both Job and handler belong to the TaskNode type, forming a tree structure that tracks parent‑child relationships and execution status. Callbacks can be attached to nodes for events such as start, finish, error, or termination.
Unlike LangGraph, which separates nodes and edges, agere adopts an edge‑node mode where each node and its outgoing edge are defined together. This makes the logical flow more coherent, as the next edge is specified when defining the node.
Parameter passing is more direct in agere: you can pass any form of arguments directly in the call without needing a unified context object, simplifying conditional edges and overall logic.
agere is highly flexible. If you prefer a clearer node‑only model, you can define TaskNode as a pure node and use callbacks to add custom edge behavior, creating simple edges, conditional edges, etc.
When using the node‑plus‑edge mode, shared context can be achieved via an ancestor node chain (e.g., a top‑level commander node that holds shared parameters).
Key differences between agere and LangGraph include:
Multi‑use : agere supports parallel execution of multiple tasks.
Timely control : callbacks allow fine‑grained control of task states.
Branching edges : edges can connect to a node’s start, end, or termination states.
Tailored parameter passing : each node can customize how parameters are passed.
Basic concepts in agere:
TaskNode
A task node (e.g., Commander, Job, handler) tracks parent‑child relationships and completion status, forming a tree that enables monitoring of task dependencies.
Job
A Job packages a specific task and the resources needed to execute it, acting like a report to a higher‑level node that says, “Here is the work I need to do; you handle it.”
handler
A handler is a function or method (similar to a coroutine) that returns a handler object, which can be invoked by other task nodes or awaited directly.
Commander
The Commander is the root node that automatically schedules and executes tasks. Once Jobs and handlers are defined, the Commander orchestrates their execution.
callback
Callbacks are functions attached to TaskNode events (start, finish, error, termination) to perform custom actions at those moments.
Example : To build a chat agent that uses OpenAI’s GPT model with tool‑calling capability and can send messages to the user simultaneously, you would define two Jobs (ChatJob and ResponseJob) and three handlers (response_handler, user_handler, tool_call_handler). A callback on ResponseJob triggers the next round of dialogue, and a Commander runs the whole flow.
The agent’s workflow diagram is shown below:
For more information, visit the GitHub repository and documentation site:
GitHub: https://github.com/happyapplehorse/agere
Documentation: https://happyapplehorse.github.io/agere/
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.