Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b7f8067
refactor custom tool call accumulation
maralbahari Jul 31, 2026
726c736
fix custom tool normalization and SSE lifecycle
maralbahari Jul 31, 2026
df90812
Merge remote-tracking branch 'origin/main' into rfc-custom-tool-call-acc
maralbahari Jul 31, 2026
93e0fc3
fix cassettes recording readme
maralbahari Jul 31, 2026
619d715
preserve custom tool constraints during normalization
maralbahari Aug 3, 2026
9cc2fb9
preserve typed custom tool outputs during normalization
maralbahari Aug 3, 2026
c13a243
restore upstream tool types and OpenAI tool choices
maralbahari Aug 3, 2026
311d364
restore custom tool metadata in streaming responses
maralbahari Aug 3, 2026
0b03239
apply authoritative done metadata to function calls
maralbahari Aug 3, 2026
b564a9b
log custom tool input envelope fallback
maralbahari Aug 3, 2026
78a9124
cover done-only custom tool call ordering
maralbahari Aug 3, 2026
294fe8d
translate custom tool SSE deltas incrementally
maralbahari Aug 3, 2026
93e96d0
Merge remote-tracking branch 'origin/main' into rfc-custom-tool-call-acc
maralbahari Aug 3, 2026
0e6c813
fix unnamed function SSE recovery and ordering
maralbahari Aug 4, 2026
928581e
reject unsupported custom tool grammar formats
maralbahari Aug 4, 2026
446b790
validate custom tool choices before normalization
maralbahari Aug 4, 2026
003ecb0
fix tests and re-record custom tool cassettes
maralbahari Aug 4, 2026
6a521e0
fix test
maralbahari Aug 4, 2026
cd77f8b
fix unit test
maralbahari Aug 4, 2026
24554a7
Merge remote-tracking branch 'origin/main' into rfc-custom-tool-call-acc
maralbahari Aug 4, 2026
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
294 changes: 222 additions & 72 deletions crates/agentic-server-core/src/executor/accumulator.rs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions crates/agentic-server-core/src/executor/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ fn item_has_meaningful_context(item: &InputItem) -> bool {
}),
},
InputItem::FunctionCall(call) => !call.name.trim().is_empty() || !call.arguments.trim().is_empty(),
InputItem::FunctionCallOutput(output) => !output.output.trim().is_empty(),
InputItem::FunctionCallOutput(output) => output.output.has_content(),
InputItem::CustomToolCall(call) => !call.name.trim().is_empty() || !call.input.trim().is_empty(),
InputItem::CustomToolCallOutput(output) => value_has_content(&output.output),
InputItem::CustomToolCallOutput(output) => output.output.has_content(),
InputItem::Reasoning(reasoning) => {
reasoning.content.iter().any(|content| !content.text.trim().is_empty())
|| reasoning.summary.iter().any(value_has_content)
Expand Down Expand Up @@ -391,7 +391,7 @@ mod tests {
user_message("first"),
InputItem::FunctionCallOutput(FunctionToolResultMessage {
call_id: "call_1".to_owned(),
output: "tool output".to_owned(),
output: "tool output".into(),
}),
user_message("second"),
];
Expand Down Expand Up @@ -428,7 +428,7 @@ mod tests {
user_message("hello context"),
InputItem::FunctionCallOutput(FunctionToolResultMessage {
call_id: "call_1".to_owned(),
output: "substantial tool output".to_owned(),
output: "substantial tool output".into(),
}),
]);

Expand Down
24 changes: 16 additions & 8 deletions crates/agentic-server-core/src/executor/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::gateway::{
GatewayCallResult, LoopDecision, append_gateway_calls_to_new_input, append_output_items_to_input,
append_tool_outputs, classify_round, emit_gateway_completed_events, emit_gateway_start_events,
execute_and_emit_output_calls, execute_output_calls, gateway_event_plans, has_client_owned_calls,
is_gateway_owned_call, public_output_items,
is_client_custom_call, is_gateway_owned_call, public_output_items,
};
use super::gateway_accumulator::{GatewayStreamAccumulator, StreamEvent, error_sse_chunk};
use crate::events::EventFrame;
Expand Down Expand Up @@ -262,13 +262,21 @@ async fn execute_and_emit_ordered_output_calls(
let first_gateway_index = output_items
.iter()
.position(|item| matches!(item, OutputItem::FunctionCall(call) if is_gateway_owned_call(call, registry)));
let first_gateway_run_end = first_gateway_index.map_or(0, |start| {
output_items[start..]
.iter()
.take_while(|item| matches!(item, OutputItem::FunctionCall(call) if is_gateway_owned_call(call, registry)))
.count()
.saturating_add(start)
});
let first_gateway_run_end = first_gateway_index
.filter(|start| {
!output_items[..*start]
.iter()
.any(|item| matches!(item, OutputItem::FunctionCall(call) if is_client_custom_call(call, registry)))
})
.map_or(0, |start| {
output_items[start..]
.iter()
.take_while(
|item| matches!(item, OutputItem::FunctionCall(call) if is_gateway_owned_call(call, registry)),
)
.count()
.saturating_add(start)
});
let first_gateway_run_len = first_gateway_run_end.saturating_sub(first_gateway_index.unwrap_or(0));
emit_gateway_start_events(&event_plans[..first_gateway_run_len], stream_accumulator, stream_sender)?;

Expand Down
Loading