Skip to content
Merged
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
4 changes: 4 additions & 0 deletions argi-agent/argi-agent-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<groupId>io.github.agentic-ai-java</groupId>
<artifactId>argi-runtime-api</artifactId>
</dependency>
<dependency>
<groupId>io.github.agentic-ai-java</groupId>
<artifactId>argi-runtime-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2025-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.agentic.ai.agent.durable;

/** Controls whether a model turn with a reserved call but no recorded response may be retried. */
public enum MissingResponsePolicy {

/** Stop recovery when the outcome of a reserved model call is unknown. */
FAIL_CLOSED,

/** Permit another model call while the total attempt limit has room. */
REASK

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2025-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.agentic.ai.agent.durable;

import static java.util.Objects.requireNonNull;

/** Immutable recovery policy and total model-call limit for one logical turn. */
public record ModelTurnAttemptPolicy(MissingResponsePolicy missingResponsePolicy, int maxAttempts) {

public static final int DEFAULT_MAX_ATTEMPTS = 1;

/** The default permits the initial call and fails closed on recovery. */
public static final ModelTurnAttemptPolicy DEFAULT =
new ModelTurnAttemptPolicy(MissingResponsePolicy.FAIL_CLOSED, DEFAULT_MAX_ATTEMPTS);

public ModelTurnAttemptPolicy {
requireNonNull(missingResponsePolicy, "missingResponsePolicy cannot be null");
if (maxAttempts < 1) {
throw new IllegalArgumentException("maxAttempts must be positive");
}
}

}
Loading
Loading