← Agent Frameworks 🕐 7 min read
Agent Frameworks

AgentCore, OTel/OpenInference, and the Agent Training Loop 2026

> Primary sources are current Amazon Bedrock AgentCore docs, OpenInference

See also (wiki): wiki/agent-operations-observability.md · wiki/semantic-observability.md · wiki/mlops-ai-platform-engineering.md · wiki/model-risk-management.md

Source credibility: MEDIUM-HIGH. Primary sources are current Amazon Bedrock AgentCore docs, OpenInference semantic conventions, Prime Intellect PRIME-RL/Verifiers docs, Unsloth docs, LLaMA-Factory docs, and Axolotl GRPO docs. This page maps how the systems fit together; it does not claim a locally verified end-to-end training run.


Executive Summary

AgentCore native features, OTel/OpenInference, and training stacks solve different problems:

  • AgentCore is the managed runtime/control plane: runtime isolation, identity, memory, gateway/tools, browser/code tools, policy, observability, and evaluations.
  • OpenTelemetry is the trace transport and correlation layer: trace_id, span_id, parent_span_id, W3C traceparent, collectors, and export pipelines.
  • AI semantic conventions are a moving choice, not a single settled layer. OpenInference gives Phoenix/Arize-style LLM, TOOL, RETRIEVER, RERANKER, AGENT, GUARDRAIL, EVALUATOR, and PROMPT span semantics. OTel GenAI gives gen_ai.* attributes for model/client, agent/framework, tool, event, and metric telemetry. MCP now has its own trace-context and semantic-convention lane for protocol/tool spans. Pin the semantic-convention version and record whether OTEL_SEMCONV_STABILITY_OPT_IN included gen_ai_latest_experimental; otherwise a collector/backend upgrade can make the same run render differently.
  • Unsloth and LLaMA-Factory are model adaptation stacks: SFT, LoRA/QLoRA, DPO, ORPO, KTO, PPO, GRPO-style workflows, and tool-calling/local-model training formats.
  • Prime Intellect / Verifiers / PRIME-RL is an environment and rollout layer for training/evaluating agents with verifiable rewards, async rollouts, multi-turn/tool-use environments, and large-scale RL infrastructure.

The durable architecture is not “send traces directly to fine-tuning.” It is:

AgentCore / local agent runtime
  -> native logs + OTel traces with OpenInference, OTel GenAI, or MCP semantics
  -> warehouse tables: turns, tool_calls, artifacts, evaluations, rollouts
  -> curated datasets: SFT rows, preference pairs, verifier environments
  -> training stacks: Unsloth, LLaMA-Factory, Axolotl, PRIME-RL, AgentCore RL Toolkit
  -> benchmark/eval promotion gate
  -> production rollout with new prompt/model/tool policy version

Layer Map

Layer System examples What it owns What it should not own
Managed agent runtime AgentCore Runtime, Memory, Gateway, Identity, Policy, Tools, Observability, Evaluations Production execution, session isolation, tool access, memory, IAM/policy, CloudWatch/native metrics, online eval hooks Training dataset curation by itself; cross-vendor raw transcript preservation
Trace transport OTel, ADOT collector, W3C trace context Causality, timing, export, collector routing Learning labels, reward functions, dataset splits
AI trace semantics OpenInference, OTel GenAI conventions, MCP semantic conventions, Phoenix/Arize LLM/tool/retriever/agent/evaluator/protocol span classification Native local session replay, full privacy policy
Workbench views AgentCore Observability, CloudWatch GenAI observability, Phoenix, LangSmith, Langfuse, Weave, Braintrust Debugging, annotation, evaluation review, trace summaries Long-term raw data lake and all training-rights decisions
Data curation Warehouse + review queues + redaction Converts traces into examples, preference pairs, verifier cases, golden sets Blindly training on raw chats
Training/post-training Unsloth, LLaMA-Factory, Axolotl, PRIME-RL, AgentCore RL Toolkit SFT, LoRA/QLoRA, DPO/ORPO/KTO, PPO/GRPO/RLVR, async rollout training Production observability or compliance logs

How AgentCore Native Features Fit

AgentCore gives the production system a managed spine:

AgentCore feature Training-loop relevance Observability requirement
Runtime Secure, long-running, isolated agent rollouts; useful for production agents and online RL-style rollout generation Root rollout span, session ID, container/runtime version, model/tool config
Memory Captures context and long-term state that can explain task success or failure Memory read/write spans, memory IDs, state hashes, retention policy
Gateway Converts APIs/Lambda/MCP tools into governed tools Tool-call spans with gateway tool ID, request/result refs, policy decision ID
Identity Propagates human/service identity into agent actions Actor/user/service principal hashes, auth method, consent/authorization refs
Policy Enforces action controls Guardrail/policy spans, policy version, allow/deny reason, human override
Browser / Code Interpreter Produces high-value tool trajectories for training and eval Tool-call IDs, files/artifacts, screenshots, code execution result, side effects
Observability Native trace/cost/latency/token dashboards and CloudWatch integration Export via OTel/ADOT; join to warehouse and model invocation logs
Evaluations Online/on-demand quality checks Eval IDs, scorer version, dataset example ID, result attached to rollout

AgentCore native observability helps, but it does not remove the need for OpenInference/warehouse normalization. The reason is simple: a training example needs lineage, redaction, labels, splits, and legal review. A trace dashboard does not decide whether a chat is training-safe.

OpenTelemetry, OpenInference, and MCP Mapping for Training

Trace/protocol signal Training value Dataset conversion
OpenInference LLM or OTel GenAI model/client span Prompt/completion behavior, token cost, model config SFT candidates only after task success and redaction; preference candidates from alternative outputs
OpenInference TOOL, OTel GenAI execute-tool span, or MCP tool span Tool routing, argument correctness, tool error recovery Tool-calling SFT rows, tool selection evals, verifier rewards for exact/semantic argument match
RETRIEVER / RERANKER spans KB findability and retrieval quality Retrieval hard negatives, query rewrite examples, RAG eval cases
AGENT / CHAIN or OTel GenAI agent/framework span Multi-step trajectory and control flow Trajectory datasets, rollout success/failure clustering, agent policy optimization
GUARDRAIL / policy span Safety/policy behavior Refusal/policy eval sets and unsafe action negative examples
EVALUATOR / evaluation span Quality labels and reward signals Golden sets, preference labels, reward functions, benchmark rows
PROMPT / prompt assembly event Prompt version and prompt assembly Prompt optimization datasets and contamination tracking
Memory read/write event Durable cross-session state and learned corrections Memory-quality evals, stale-memory defect cases, memory poisoning review
Context event Compaction, tool-output offload, code-filtering, token-budget changes Context regression cases and cost/reliability attribution

Version every emitted AI semantic layer:

{
  "trace_id": "trace_hash",
  "span_id": "span_hash",
  "ai_semantic_convention": "otel_genai",
  "ai_semantic_convention_version": "1.41.1",
  "semconv_stability_opt_in": "gen_ai_latest_experimental",
  "instrumentation_name": "strands-agents",
  "instrumentation_version": "x.y.z"
}

Minimum join keys:

{
  "rollout_id": "rollout_hash",
  "trace_id": "trace_hash",
  "span_id": "span_hash",
  "turn_id": "turn_hash",
  "tool_call_id": "tool_hash",
  "artifact_id": "artifact_hash",
  "eval_id": "eval_hash",
  "memory_event_id": "memory_hash",
  "context_event_id": "context_hash",
  "compaction_id": "compaction_hash",
  "dataset_example_id": "example_hash",
  "prompt_version": "prompt_v12",
  "model_artifact_id": "adapter_or_checkpoint_hash",
  "policy_version": "policy_v4"
}

How Traces Become Training Data

Training target Input from observability Required curation Good use case Bad use case
SFT / instruction tuning Successful turns, final artifacts, corrected outputs Redaction, dedupe, deterministic pass/fail, schema validation Teach domain YAML shape, tool-call JSON format, citation format Learning from unverified raw chats
Tool-calling SFT TOOL spans plus successful results Exact tool name, argument schema, result/error, side effects Improve local model tool-call formatting Training on tool calls that failed silently
Preference optimization: DPO/ORPO/KTO/SimPO Accepted vs rejected outputs, human labels, scorer comparisons Paired/ranked outputs, judge calibration, contamination control Prefer concise valid YAML over verbose invalid YAML Using noisy thumbs-up/down without task context
PPO/GRPO/RLVR Environment prompts, rollouts, verifier rewards Verifiable reward function, rollout replayability, baseline evals Code/math/YAML tasks with deterministic validators Open-ended chat quality without reliable reward
Online distillation Teacher traces and scored student outputs Teacher quality checks, privacy review, held-out validation Smaller model mimics tool routing or formatting Distilling hallucinations or policy violations
Prompt optimization / GEPA-style loops Eval failures grouped by prompt version and failure code Failure taxonomy, prompt diff tracking, golden/canary split Improve instructions before fine-tuning Treating prompt tuning as model training evidence

Unsloth and LLaMA-Factory Fit

Unsloth is strongest when the goal is fast local or single/few-GPU adaptation: LoRA/QLoRA, SFT, tool-calling format tuning, DPO/ORPO/KTO, and GRPO-style reasoning/RL workflows. It is useful after the warehouse has produced training-safe rows.

LLaMA-Factory is a broader training workbench with YAML/CLI training configs for pretraining, SFT, reward modeling, PPO, DPO, KTO, ORPO, and related preference losses. It is useful when a team wants a repeatable training recipe and compatibility across many open models.

Neither tool replaces AgentCore observability. They consume curated datasets derived from traces and evals.

Example conversion for a domain YAML generator:

{
  "messages": [
    { "role": "system", "content": "Generate only valid policy YAML for schema v3." },
    { "role": "user", "content": "Create policy for case class A with controls X and Y." },
    { "role": "assistant", "content": "kind: Policy\nversion: v3\n..." }
  ],
  "metadata": {
    "source_trace_id": "trace_hash",
    "source_artifact_id": "artifact_hash",
    "schema_name": "policy_yaml_v3",
    "validator_status": "passed",
    "redaction_version": "stateofai-redaction-v1"
  }
}

For preference training:

{
  "prompt": "Create policy YAML for case class A with controls X and Y.",
  "chosen": "kind: Policy\nversion: v3\n...",
  "rejected": "Here is the YAML you asked for:\n```yaml\n...",
  "metadata": {
    "failure_code": "extraneous_markdown_fence",
    "judge": "deterministic_yaml_validator",
    "source_rollout_id": "rollout_hash"
  }
}

Prime Intellect / Verifiers / PRIME-RL Fit

Prime Intellect’s key contribution is the environment layer. Its docs describe Verifiers environments as packages that can drive RL training, standalone evaluation, and synthetic data generation. PRIME-RL is positioned as an async RL trainer for multi-turn/tool-use environments, LoRA adapters, large-scale multi-node training, MoE models, SFT, online distillation, and RL.

This pattern is bigger than one vendor. The converging abstraction is an environment package: the same package can define task generation, reset state, tool access, validators/rewards, eval metrics, synthetic-data generation, and rollout capture. For agent training, that environment is the contract that turns traces into repeatable experiments. Without it, RLVR/GRPO data is just a pile of scored transcripts with weak replay value.

That maps cleanly to this observability standard:

Prime/Verifiers concept Standard concept
Environment package Benchmark/eval harness plus reward function
Prompt Dataset example input or task seed
Rollout rollout_id plus OTel trace tree
Multi-turn interaction turns, messages, tool_calls
Tool execution TOOL spans and tool_calls rows
Rubric/reward evaluations row or EVALUATOR span
Trajectory Ordered action/observation artifact
Training batch Curated examples with lineage and split
Model update model_artifact_id plus training job metadata

The important architecture decision: if an AgentCore-hosted agent is used to generate rollouts for PRIME-RL or a Verifiers environment, pass the same rollout_id and W3C traceparent through AgentCore, OTel, the environment, and the trainer. Otherwise, the training job will know reward, but the observability system will not know why the reward happened.

SOTA Training Methods in This Context

Method What it optimizes Best fit for agent systems Observability dependency
SFT Imitate known-good outputs Formatting, tool-call syntax, domain YAML, citation style Passed artifacts and corrected outputs
LoRA/QLoRA Efficient adaptation Small/domain adapters, local models, cost-sensitive experiments Dataset lineage and held-out evals
DPO Prefer chosen over rejected responses Human/scorer preference data, style, safety, concise correctness Reliable pairs and judge calibration
ORPO/KTO/SimPO Preference-style alignment variants Lower-friction preference or binary feedback settings Strong labels and split discipline
PPO Online RL with reward model/environment Interactive tasks with delayed reward Reward logs, rollout traces, reference model metadata
GRPO/RLVR Grouped online RL with verifiable rewards Math/code/schema/tool tasks with programmatic validators Verifier outputs, multiple samples per prompt, trace IDs
DAPO GRPO-family RL with decoupled clipping and dynamic sampling techniques Long-reasoning RL where vanilla GRPO has entropy/sample-efficiency issues Reward variance, sample filtering, response-length stats
Dr. GRPO / bias-corrected GRPO variants GRPO-family objective corrections for length/aggregation/reward-noise bias Reasoning tasks where response length or noisy rewards distort updates Length distributions, reward noise estimates, per-token/sequence aggregation
GSPO Sequence-level importance-ratio/clipping optimization MoE and long-sequence RL stability Sequence likelihoods, MoE routing/stability metrics, rollout groups
Step-level / process-supervised RL Rewards intermediate decisions rather than only final trajectory outcome Multi-step tool agents where flat final rewards under-specify credit assignment Step labels, tool-result validators, process rewards, trace tree alignment
Online distillation Student learns from teacher/rollouts Smaller model for a bounded agent node Teacher quality labels and failure filtering
Prompt optimization / GEPA Improve prompt/program without weight changes First move for domain YAML, retrieval, tool routing Failure clusters by prompt version and eval code

For corporate agent systems, the recommended order is:

  1. deterministic evals and golden/canary sets;
  2. prompt/tool-policy optimization;
  3. retrieval and schema validation fixes;
  4. SFT on validated examples;
  5. preference optimization for style/safety/selection;
  6. RLVR/GRPO-family methods only where rewards are verifiable and environments are stable.

The reward caveat matters more than the algorithm label. RLVR is strongest when the outcome is externally checkable: unit tests, math answers, executable code, schema-valid YAML, SQL result equivalence, policy-rule checks, or exact tool argument validation. Most corporate agent workflows are multidimensional: helpfulness, policy appropriateness, business judgment, source sufficiency, tone, latency, cost, and authorization all matter at once. In those workflows, reward design and evaluator calibration are the bottleneck. Switching from GRPO to a newer variant does not fix a bad or subjective reward function.

Self-Improving Curriculum Loop

Retrospective mining finds repeated successes and failures in existing traces. The next rung is closed-loop curriculum generation:

failure clusters + weak skills
  -> generate calibrated tasks
  -> run agent/model in an environment package
  -> verify with deterministic or rubric-backed rewards
  -> add hard-but-valid cases to golden/canary sets
  -> train or prompt-optimize
  -> re-run held-out evals before promotion

This is useful for domain YAML generation because the environment can synthesize schema-constrained cases, run validators, and emit exact failure codes. It is dangerous for subjective enterprise workflows unless task generation, reward models, and held-out benchmarks are separated to avoid reward hacking and eval leakage.

Practical Architecture

Production / lab agent
  AgentCore Runtime or local runner
  AgentCore Gateway / MCP / browser / code tools
  AgentCore Memory / policy / identity
        |
        v
  OTel + OpenInference spans
        |
        v
  Raw vault + warehouse
  raw_events, agent_spans, turns, tool_calls, artifacts, evaluations
        |
        +--> Phoenix/LangSmith/Langfuse/Braintrust/Weave for review
        |
        +--> dataset builder
              SFT rows, preference pairs, verifier environments, golden sets
                    |
                    +--> Unsloth / LLaMA-Factory / Axolotl
                    +--> Prime-RL / Verifiers / AgentCore RL Toolkit
                    |
                    v
              model/prompt/tool-policy candidate
                    |
                    v
              benchmark gate -> production rollout

Hard Boundaries

  • Do not use AgentCore Observability as the training dataset. Use it as a trace and debugging source feeding a governed curation layer.
  • Do not use OpenInference spans as the only training format. Convert spans into SFT/preference/RL examples with labels, splits, lineage, and redaction.
  • Do not fine-tune before deterministic validators and prompt optimization have been tried for schema-bound tasks.
  • Do not run RL unless the reward is stable, cheap enough, and resistant to reward hacking.
  • Do not ignore model architecture: small LoRA adapters, MoE RL, long-context GRPO, and local tool-calling models have different data and compute needs.

Sources


Brandon Sneider | brandon@brandonsneider.com June 2026