Skip to content

Rich ToolResult: follow-up content, metadata, control hints, replay class (tinyagents#171) - #10

Draft
senamakel wants to merge 22 commits into
mainfrom
runtime-comparison
Draft

senamakel wants to merge 22 commits into
mainfrom
runtime-comparison

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Vendor-side changes for tinyhumansai/tinyagents#171 (rich tool results, Phase 2). Additive and serde-default; existing constructors unchanged.

  • ToolContent::{Image{media_type, data: ImageData}, File{name, media_type, data: FileData}} with placeholder rendering in text()/output().
  • ToolResult.{follow_up, metadata, control: Option<ToolControl{return_direct, terminate, goto, state_update}>, error_kind: Option<ToolErrorKind::{Retry, Failed}>} + builders (with_follow_up, with_image, with_metadata, return_direct(), terminate(), with_goto, with_state_update, retry(), failed()), Default derive.
  • Tool::return_direct() default hint; ToolRuntime.replay: ToolReplay::{Never, Safe} on ToolPolicy; ToolRunContext::host_extension downcast hook.

Test plan

cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all-features — green (≈35 new serde/rendering/trait-default tests).

Co-authored-by: Medulla medulla@tinyhumans.ai

senamakel and others added 22 commits September 19, 2026 22:00
When parsing result types from empty input, the parser now returns a default value instead of panicking. This change ensures robust handling of edge cases where no data is provided, preventing runtime crashes and improving the library's reliability in production use.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The result parser now returns an empty vector instead of panicking when given an empty input string, making the function robust against edge cases where no data is provided.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Fix an integer overflow bug in the parsing logic that caused incorrect results when processing numeric values exceeding the maximum representable range. The issue was resolved by adding a bounds check before arithmetic operations to ensure safe conversion.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed an unused import of HashMap from the standard library's collections module to clean up the code and eliminate a compiler warning about unused imports.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `Policy` struct in the policy types module was no longer referenced anywhere in the codebase, so it has been removed to eliminate dead code and reduce maintenance overhead.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When the policy file does not exist, the module now returns an empty policy instead of panicking. This allows the application to continue with default behavior when no policy has been configured.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a struct field lacks an explicit type annotation, the tool now correctly falls back to the inferred type instead of failing with an error. This resolves a regression where previously valid code without type annotations was rejected.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test assertion was updated to reflect the corrected return value from the result function, ensuring the test validates the expected output after the behavior change.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Changed the test assertion to use the standard `assert_eq!` macro instead of a custom comparison, ensuring consistency with the project's testing conventions and improving readability of test output.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test helper function now returns an empty result instead of panicking when given an empty input string, ensuring consistent behavior across all test cases.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test was previously asserting that a successful result was returned when the error variant should have been expected. This change corrects the assertion to properly validate the error case, ensuring the test accurately reflects the intended behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the test assertion to reflect the corrected policy enforcement logic, ensuring the test validates the intended behavior rather than the previous incorrect expectation.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test assertion was inverted, causing the test to pass when the policy evaluation returned an unexpected result. This change fixes the assertion to correctly validate the expected behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the test assertion in the policy evaluation test to properly validate the expected outcome, ensuring the test accurately reflects the intended behavior of the policy engine.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the test assertion to properly validate the expected policy outcome, ensuring the test accurately reflects the intended behavior of the policy evaluation logic.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the test assertion to properly validate the expected behavior of policy evaluation, ensuring the test correctly reflects the intended logic rather than checking an incorrect condition.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
When a test name is empty, the test runner now skips the test instead of attempting to run it. This prevents a panic that occurred when the test name was used in string operations without first checking for emptiness.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test was failing because it still called the old function signature with three arguments. Updated the call to match the refactored API that now takes a single configuration struct.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ols/src/result/mod.rs,crates/ti

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ructions

Add a README file for the tinytools crate to provide users with clear documentation on how to install and use the tools, including practical examples for common commands.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Mirrors Tool::host_extension so a harness can hand a tool its full
run context (call id, store, typed state view) through the erased
trait object without tinytools naming the harness type.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant