Skip to content

feat: implement Agent execution loop and type-safe compile-time Tool binding system#4

Merged
mrazza merged 35 commits into
mainfrom
feat/agent-loop-api
Jul 11, 2026
Merged

feat: implement Agent execution loop and type-safe compile-time Tool binding system#4
mrazza merged 35 commits into
mainfrom
feat/agent-loop-api

Conversation

@mrazza

@mrazza mrazza commented Jul 8, 2026

Copy link
Copy Markdown
Owner

This PR introduces the new agent module, abstracting agent execution turns and tool bindings. It replaces the previous manual message-and-tool dispatching loop in src/main.zig with a clean, centralized Agent orchestration loop.

Additionally, it adds a compile-time tool validator and wrapper in Tool.zig that allows arbitrary Zig functions to be safely registered as LLM tools, handles out-of-order/optional parameters, validates types, and injects allocators automatically.

Comment thread src/agent/Tool.zig Outdated
mrazza added 19 commits July 10, 2026 17:35
…threadlocal storage for global I/O and mock provider

@oca-agent oca-agent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent contribution! This PR adds a very clean, type-safe Agent execution loop and comptime Tool wrapper. Overall, the architecture, design, and memory safety are stellar. I have identified a couple of minor areas where memory management and efficiency can be further optimized according to Zig best practices.

Comment thread src/agent/Tool.zig Outdated
Comment thread src/provider/google/accumulator.zig
Comment thread src/agent/Agent.zig
@mrazza mrazza marked this pull request as ready for review July 11, 2026 21:03

@oca-agent oca-agent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look excellent! The hash map lookup has been cleanly refactored to a zero-allocation linear search, and OutOfMemory errors are now correctly propagated instead of being swallowed. All 131 tests compile and pass perfectly. Code is extremely clean. Approving!

@mrazza mrazza merged commit 781fd0a into main Jul 11, 2026
2 checks passed
@mrazza mrazza deleted the feat/agent-loop-api branch July 11, 2026 21:07
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.

2 participants