Observed since 20 Oct, 17:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Agent design pattern core framework
Agent design pattern core framework for building, orchestrating, and training AI agents.
aap_core is the foundational framework within the AI Agent Pattern project. It provides a unified abstraction layer for building AI agents, orchestrating multi-agent workflows, and training policies via reinforcement learning — all built on Pydantic and compatible with the A2A protocol.
The framework separates orchestration logic from LLM manipulation, delegating model interaction to integration packages (aap_langchain, aap_llamaindex, aap_dspy, aap_transformers). This lets you swap backends without changing agent architecture.
pip install aap_core
# or
uv add aap_core
from a2a.types import AgentCard
from aap_core.agent import BaseAgent
from aap_core.types import AgentMessage
# Define a minimal agent
class MyAgent(BaseAgent):
card: AgentCard = AgentCard(
name="my-agent",
description="A simple agent",
skills=[],
)
def execute(self, message: AgentMessage, **kwargs) -> AgentMessage:
# Your agent logic here
message.responses = [("my-agent", "Hello!")]
message.execution_result = "success"
return message
BaseAgent interface with A2A AgentCard integration for self-describing agent metadataaexecute)pip install aap_core
pip install aap_langchain # LangChain integration
pip install aap_llamaindex # LlamaIndex integration
pip install aap_dspy # DSPy integration
pip install aap_transformers # Hugging Face Transformers integration
from aap_core.agent import BaseAgent
from aap_core.types import AgentMessage
from a2a.types import AgentCard
class TaskAgent(BaseAgent):
def execute(self, message: AgentMessage, **kwargs) -> AgentMessage:
self.state = "running"
# Process the message...
message.responses = [(self.card.name, "Task completed")]
message.execution_result = "success"
self.state = "idle"
return message
from aap_core.orchestration import ReflectionAgent, LoopAgent
# Self-reflection: execute then reflect on the result
reflector = ReflectionAgent(
chain_task=my_chain,
chain_reflection=reflection_chain,
)
result = reflector.execute(message)
# Loop until a condition is met
stopper = lambda msg: "done" in msg.query.lower()
loop = LoopAgent(agent=my_agent, stop_condition=stopper)
result = loop.execute(message)
from aap_core.prompt_augmenter import SimplePromptAugmenter
# Augment prompts with external context data
augmenter = SimplePromptAugmenter(
format="Context:\n{context}\n\nQuery: {query}",
loop=3, # Apply 3 times
)
augmented = augmenter(message)
from aap_core.policy_trainer import PPOTrainer, SimpleReplayBuffer
from aap_core.prompt_augmenter import PromptOptimizationEnv
# Create the environment with multiple augmenters
env = PromptOptimizationEnv(augmenters=[augmenter_a, augmenter_b])
# Create a replay buffer and trainer
buffer = SimpleReplayBuffer(capacity=10000)
trainer = PPOTrainer(policy=my_policy, buffer=buffer)
trainer.train(env, num_steps=10000)
aap_core is organized into the following modules:
| Module | Description |
|---|---|
agent | Base agent interface with A2A AgentCard support and state management |
orchestration | Multi-agent patterns: reflection, looping, voting, coordination, debate |
chain | Generic multi-turn causal chains with history, tool processing, and token tracking |
policy | RL policy models (GPT-2 based) with RMSNorm, RoPE, and GQA |
policy_trainer | Replay buffers, exploration modules, and trainers (PPO, DPO, GRPO, Reinforce++) |
prompt_augmenter | Data and structure-based prompt enhancement with Gymnasium environments |
retriever | Pluggable retrieval system with post-processing support |
thought | Thought chain patterns: CoT, ToT, GoT, Self-Consistency |
guardrail | Input/output filtering system |
types | Core type definitions: AgentMessage, TokenUsage, BaseLLMChain, BaseChain |
utils | Utility functions (e.g., thinking tag removal) |
See the main project README for contribution guidelines.
This project is licensed under the MIT License — see the LICENSE file for details.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.3.0 | 16 Oct 2026 | 11 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:bc9625ceef2359fffecdc71570691fd212e9452ca0f7ad3d4c0c88f346a64c94