План лекции
Сначала мы разберем Agentic Context Engine, или ACE, как инструмент не столько для хранения воспоминаний, сколько для обучения агента на опыте. Его цель - чтобы агент не повторял одни и те же ошибки, а превращал traces, failures and feedback в reusable strategies.
Затем рассмотрим основные роли ACE: Agent, Reflector and SkillManager. После этого разберем Skillbook, recursive reflection, trace analysis, pipeline architecture and runners. В конце сравним ACE с MemSearch and memU, покажем, где он относится к memory course, and перечислим риски автоматического learning loop.
Цель лекции
Понять Agentic Context Engine как open-source engine for persistent learning loops: систему, которая добавляет reflection/procedural memory поверх agent execution.
Ожидаемый результат
После лекции читатель понимает:
- почему ACE не является классическим vector memory;
- что такое Skillbook;
- как Reflector and SkillManager превращают traces в strategies;
- зачем нужен recursive reflection;
- как pipeline steps compose learning loop;
- где ACE полезен для production agents;
- какие safety boundaries нужны для self-improving memory.
Короткая карточка инструмента
| Поле | Значение |
|---|---|
| Repository | https://github.com/kayba-ai/agentic-context-engine |
| Docs | https://kayba-ai.github.io/agentic-context-engine |
| Hosted product | https://kayba.ai |
| Stars snapshot | около 2.5k на 2026-08-08 по GitHub page |
| Primary language | Python |
| License | Apache-2.0 |
| Category | Agent learning / context engineering |
| Core memory object | Skillbook strategies |
| Storage claim | No fine-tuning, no training data, no vector database for quickstart pattern |
ACE позиционируется как engine that makes agents learn from experience. Это другой подход к memory: память хранит не только facts, но и strategies learned from successes and failures.
Почему ACE относится к agent memory
Если memory понимать узко как "куда положить факты", ACE выглядит не совсем memory framework. Но если memory понимать как способность системы изменять future behavior based on past experience, ACE попадает прямо в центр темы.
В классическом agent loop:
task -> agent -> answer/action -> done
В ACE loop:
task -> agent -> trace -> reflection -> strategy update -> better future attempt
Это reflection memory and procedural memory. Агент не просто вспоминает прошлую ошибку, а получает стратегию, которая должна изменить его поведение.
Базовая архитектура
README описывает три роли:
| Role | Responsibility |
|---|---|
| Agent | Executes tasks, enhanced with Skillbook strategies. |
| Reflector | Analyzes execution traces to extract what worked and failed. |
| SkillManager | Curates Skillbook: adds, refines and removes strategies. |
В этой схеме Skillbook - долговременная память. Но он хранит не "conversation chunks", а strategies.
Skillbook
Skillbook - persistent collection of strategies. Стратегия может выглядеть так:
Before answering a question about Unicode emoji existence,
verify against Unicode data or avoid assuming visual plausibility.
Это procedural guidance. Она должна быть:
- короткой;
- actionable;
- применимой к будущим задачам;
- derived from actual trace or feedback;
- removable if harmful;
- deduplicated with similar strategies.
Skillbook отличается от prompt instruction тем, что он evolves with experience. Он не пишется один раз вручную, а обновляется после задач.
Learning from feedback
Quickstart README показывает простой pattern:
agent.ask(...)
agent.learn_from_feedback(...)
agent.ask(...) # subsequent calls use learned strategy
Педагогически важно понять sequence:
- Agent makes a mistake.
- User or evaluator gives correction.
- ACE extracts a strategy.
- SkillManager updates Skillbook.
- Future task includes relevant strategy.
Это похоже на human postmortem. Ошибка полезна только если она превращается в правило, которое реально применяется потом.
Learning from traces
ACE может учиться from existing traces. Это особенно полезно, если у вас уже есть:
- agent logs;
- failed browser automation runs;
- tool call histories;
- CI failures;
- support transcripts;
- benchmark rollouts;
- QA datasets.
Trace-based learning важен для production: не нужно ждать новых failures after installing ACE. Можно загрузить прошлые traces and extract strategies from them.
Recursive Reflector
README выделяет Recursive Reflector как key innovation. Вместо single-pass summary он пишет and executes Python code in sandboxed environment to programmatically search for patterns, isolate errors and iterate until actionable insights emerge.
Это стоит разобрать аккуратно.
Single-pass reflection:
Trace -> LLM summary -> strategy
Recursive reflection:
Trace -> generate analysis code -> run analysis -> inspect results -> iterate -> strategy
Это мощнее, но и рискованнее. Execution sandbox, limits and observability become part of memory safety.
Pipeline architecture
ACE построен на composable pipeline engine. README дает стандартную последовательность:
AgentStep -> EvaluateStep -> ReflectStep -> UpdateStep -> DeduplicateStep
Каждый step declares what it requires and produces. Это делает learning loop configurable.
| Step | Смысл |
|---|---|
| AgentStep | Запустить agent on task. |
| EvaluateStep | Оценить result or collect signal. |
| ReflectStep | Проанализировать trace and outcome. |
| UpdateStep | Обновить Skillbook. |
| DeduplicateStep | Убрать повторяющиеся or overlapping strategies. |
Pipeline approach полезен, потому что разные domains have different evaluation signals. Browser automation, coding tasks and customer support need different scoring and trace processing.
Runners
ACE предлагает несколько runners:
ACELiteLLMfor simple.ask(),.learn(),.save();- core
ACEfor full learning loop with batch epochs and evaluation; TraceAnalyserfor pre-recorded traces;BrowserUsefor browser automation;LangChainwrapper;ClaudeCoderunner;- MCP server for IDE integration.
Это показывает, что ACE стремится быть framework around learning, not only one SDK adapter.
Чем ACE отличается от retrieval memory
Retrieval memory отвечает:
Что из прошлого релевантно текущему запросу?
ACE отвечает:
Какой strategy from previous experience should change the agent's behavior?
| Retrieval memory | ACE-style learning memory |
|---|---|
| Stores facts/chunks/episodes | Stores strategies |
| Retrieves context | Updates behavior |
| Useful for recall | Useful for consistency improvement |
| Often vector/graph backed | Skillbook and pipeline backed |
| Quality measured by relevance | Quality measured by future task success |
Это одна из самых важных идей модуля: не вся память обязана быть search.
Связь с context engineering
ACE называется Agentic Context Engine не случайно. Strategy из Skillbook становится частью context, который получает agent.
Но context здесь не просто data injection. Это learned guidance:
When doing task type X, remember strategy Y because previous traces showed failure Z.
Это похоже на evolving system prompt, но более structured and evidence-based.
Типы памяти из курса
| Тип памяти | Как ACE его закрывает |
|---|---|
| Reflection memory | Центральный фокус: анализ traces and feedback. |
| Procedural memory | Strategies in Skillbook. |
| Episodic memory | Execution traces as raw experience. |
| Semantic memory | Derived lessons about task/domain. |
| Shared memory | Skillbook can be reused across agents/runners. |
| World memory / RAG | Не основной фокус. |
ACE особенно полезен там, где agent repeatedly attempts similar tasks and can improve by extracting strategies.
Мини-кейс: browser automation
Browser agent repeatedly fails because it clicks before page content loads. A trace shows:
- click action happened too early;
- element appeared 800 ms later;
- retry solved the issue;
- failures repeated in several runs.
ACE reflection may produce strategy:
Before clicking dynamic elements, wait for both selector visibility and network idle;
if the first click fails, re-query DOM before retrying.
Future runs include this strategy and become more consistent. This is not a memory of a website fact; it is a learned operating principle.
Мини-кейс: coding agent
Coding agent repeatedly breaks build after refactoring because it updates code but forgets generated schema.
Trace:
- tests fail with missing generated type;
- manual fix runs
make generate; - second attempt passes;
- same pattern repeats.
ACE can add strategy:
After modifying API schema or model definitions, run code generation before tests.
This is procedural memory. It turns failure into reusable rule.
Сравнение с MemSearch
| Критерий | MemSearch | ACE |
|---|---|---|
| Главный объект | Markdown memory and search index | Skillbook strategies |
| Основной вопрос | What did we discuss before? | What should the agent learn from experience? |
| Retrieval | Hybrid + progressive | Strategy injection |
| Source data | Conversations, daily journals, transcripts | Traces, feedback, evaluations |
| Output | Context chunks, sections, skills | Strategies and updated Skillbook |
| Evaluation | Recall relevance/fidelity | Future task success/consistency |
MemSearch helps recover past context. ACE helps improve future behavior.
Сравнение с memU
memU and ACE both touch procedural memory. Difference:
- memU turns agent history into readable Markdown skills, often user-reviewed;
- ACE runs a more explicit learning loop with Reflector and SkillManager;
- memU is closer to personal/coding assistant memory;
- ACE is closer to benchmarked agent improvement and context engineering.
Для high-risk environments memU's human-readable review may be safer. Для repeated benchmark/workflow optimization ACE may be more powerful.
Риски и ограничения
Первый риск - bad strategies. Если reflector extracts wrong lesson, future behavior degrades.
Второй риск - overfitting. Strategy learned from one trace may not generalize.
Третий риск - sandbox risk. Recursive reflection executes generated code; sandboxing and resource limits are mandatory.
Четвертый риск - evaluation leakage. Если strategies learn benchmark quirks instead of robust principles, metrics improve but real performance does not.
Пятый риск - instruction conflict. Skillbook strategies can conflict with system policies, user preferences or newer domain rules.
Как тестировать ACE
| Тест | Что проверяет |
|---|---|
| Feedback learning | Correction becomes actionable strategy. |
| Trace learning | Pre-recorded traces produce useful strategies. |
| Regression | New strategy improves similar task without hurting unrelated tasks. |
| Deduplication | Similar strategies do not accumulate endlessly. |
| Removal | Harmful strategy can be removed. |
| Sandbox | Recursive reflection cannot access unsafe resources. |
| Policy priority | Strategies cannot override safety/system instructions. |
| Evaluation split | Learned strategies tested on held-out tasks. |
Для ACE особенно важен held-out evaluation. Иначе система может выглядеть умной на прошлых traces and fail in new variants.
Практический rollout
Начните с offline trace analysis. Возьмите 20-50 past failures, пусть ACE извлечет candidate strategies, затем review manually.
Затем включите strategies only for one agent and one task class. Измеряйте:
- success rate;
- token cost;
- latency;
- number of repeated failures;
- number of harmful strategies;
- rollback frequency.
Только после этого включайте automatic updates.
Антипаттерны
Первый антипаттерн - считать любую reflection полезной. Reflection can invent false lessons.
Второй антипаттерн - добавлять strategies forever without pruning.
Третий антипаттерн - запускать recursive analysis без sandbox and limits.
Четвертый антипаттерн - измерять успех only on training traces.
Пятый антипаттерн - использовать ACE вместо factual memory. Если агенту нужно помнить user preferences, Skillbook is not enough.
Чек-лист выбора ACE
ACE стоит рассмотреть, если:
- agent repeatedly performs similar tasks;
- failures can be captured as traces;
- there is a meaningful evaluation signal;
- strategies can improve future attempts;
- команда готова review and prune learned strategies;
- procedural consistency matters more than factual recall;
- you need framework around learning loops.
Если нужна память о пользователе, выберите Supermemory/Mem0/Honcho. Если нужен поиск по прошлым coding sessions, MemSearch. Если нужны readable skills with user control, memU.
Источники
- GitHub repository: https://github.com/kayba-ai/agentic-context-engine
- README: https://github.com/kayba-ai/agentic-context-engine/blob/main/README.md
- Documentation: https://kayba-ai.github.io/agentic-context-engine
- Kayba hosted product: https://kayba.ai
- ACE paper referenced by README: https://arxiv.org
Краткое резюме
Agentic Context Engine показывает memory as learning loop. Его память - это Skillbook strategies, которые появляются из traces, feedback and reflection, а затем меняют future behavior агента.
Главная идея урока: agent memory не всегда обязана быть базой фактов. Иногда самая ценная память - это процедура, извлеченная из ошибки.
Вопросы для самопроверки
- Почему ACE не является обычным vector memory framework?
- Что хранит Skillbook?
- Чем Reflector отличается от SkillManager?
- Зачем ACE анализирует traces?
- Что дает recursive reflection?
- Почему strategies нужно тестировать на held-out задачах?
- Когда MemSearch полезнее ACE?
- Какие риски появляются у self-improving memory loop?
Что дальше
В следующей лекции мы разберем Semantica - инструмент из класса semantic/episodic memory, где нас будет интересовать, как lightweight memory systems organize meaning and retrieval for agents.