-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Tasks and Feedback
rrahimi-uci edited this page Jun 30, 2026
·
1 revision
Two extension points make ACE general-purpose: bring your own Task and your own
feedback. No ground-truth labels are required.
from ace import ACE, Feedback, Sample, Task, OpenAILLM
my_task = Task(name="my-domain", samples=[Sample(id="1", question="...")],
evaluate=lambda pred, s: my_score(pred, s))
def my_feedback(sample, generation) -> Feedback:
# plug in execution signals, a reward fn, or an LLM judge — your call
ok = run_my_checks(generation.answer)
return Feedback(correct=ok, signal="tests passed" if ok else "tests FAILED")
ace = ACE(OpenAILLM(model="gpt-4o-mini"))
ace.adapt_online(my_task, feedback_fn=my_feedback) # learns from YOUR signalsSee
examples/05_custom_task.py
(runs offline) and cookbook recipes 03–04.
ACE adapts with or without ground-truth labels. The label-free path is what makes it work for live agents (the paper's headline AppWorld result).
| Regime | How to use it | Example |
|---|---|---|
| Labeled | provide sample.answer; use_labels=True (default) |
offline system-prompt optimization on a train split |
| Custom hook | pass feedback_fn(sample, generation) → Feedback
|
code tests pass/fail, API status, a reward model |
| Pure label-free |
signal=... via the hook, no ground_truth
|
live agent learning from environment responses |
flowchart TD
ST["ACE.step(sample, feedback)"] --> D{"feedback_fn provided?"}
D -- yes --> CF["Caller computes Feedback (execution signal · reward · LLM-judge)"]
D -- no --> L{"labels available? (use_labels and sample.answer)"}
L -- yes --> GT["grade vs task.evaluate(): Feedback(correct, ground_truth)"]
L -- no --> NS["Feedback(correct=None): nothing reliable to learn from"]
CF --> R["Reflector"]
GT --> R
NS --> R
ACE is robust under rich feedback but can degrade without reliable signals — the quality of your
feedback_fnmatters.
-
New backend — implement the two-method
LLMprotocol (complete,complete_json) and pass it toACE(...). -
New agent framework — mirror
ace/integrations/openai_agents.py: injectplaybook.render()into the system prompt and callace.step(...)with the captured trajectory. -
Curation mode — by default the Curator calls the LLM to propose
ADD/UPDATE/REMOVEedits, with a deterministic ADD-only fallback that never drops a distilled lesson. SetACEConfig(curator_use_llm=False)to force the deterministic path. -
Semantic dedupe — pass
embedder=make_openai_embedder()(or any batched embedding callable) toACE(...)for embedding-based de-duplication.
See Configuration for the full set of knobs.
ACE — Agentic Context Engineering · MIT · Independent open-source reproduction of ICLR 2026 arXiv:2510.04618. All credit for the method belongs to the original authors.