Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 8 additions & 184 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions core/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ pub(crate) struct AgentConfig {
pub goal_tracking: bool,
/// Optional hook engine for firing lifecycle events (PreToolUse, PostToolUse, etc.)
pub hook_engine: Option<Arc<dyn HookExecutor>>,
/// Optional structured JSONL trajectory recorder for RL training and service data capture.
pub rl_trajectory_recorder: crate::rl_trajectory::RlTrajectoryRecorder,
/// Optional skill registry for tool permission enforcement
pub skill_registry: Option<Arc<crate::skills::SkillRegistry>>,
/// When true, active skill `allowed-tools` restrict ordinary session tool calls.
Expand Down Expand Up @@ -183,6 +185,7 @@ impl std::fmt::Debug for AgentConfig {
.field("planning_mode", &self.planning_mode)
.field("goal_tracking", &self.goal_tracking)
.field("hook_engine", &self.hook_engine.is_some())
.field("rl_trajectory", &self.rl_trajectory_recorder.is_enabled())
.field(
"skill_registry",
&self.skill_registry.as_ref().map(|r| r.len()),
Expand Down Expand Up @@ -230,6 +233,7 @@ impl Default for AgentConfig {
planning_mode: PlanningMode::default(),
goal_tracking: false,
hook_engine: None,
rl_trajectory_recorder: crate::rl_trajectory::RlTrajectoryRecorder::disabled(),
skill_registry: Some(Arc::new(crate::skills::SkillRegistry::with_builtins())),
enforce_active_skill_tool_restrictions: false,
max_parse_retries: 2,
Expand Down
16 changes: 16 additions & 0 deletions core/src/agent/execution_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ impl AgentLoop {
a3s.llm.total_tokens = r.usage.total_tokens,
"a3s.agent.execute completed"
);
self.config.rl_trajectory_recorder.record_execution_end(
session_id.unwrap_or(""),
true,
Some(&r.text),
Some(&r.usage),
Some(r.tool_calls_count),
None,
);
self.fire_post_response(
session_id.unwrap_or(""),
&r.text,
Expand All @@ -204,6 +212,14 @@ impl AgentLoop {
error = %e,
"a3s.agent.execute failed"
);
self.config.rl_trajectory_recorder.record_execution_end(
session_id.unwrap_or(""),
false,
None,
None,
None,
Some(&e.to_string()),
);
self.fire_on_error(
session_id.unwrap_or(""),
ErrorType::Other,
Expand Down
Loading
Loading