The Problem

Building intelligent agents that can handle complex interactions, especially in multi-turn conversations, can be a nightmare. You want a framework that handles state, allows for tool integration, and lets you customize behavior without reinventing the wheel. Enter the ia-agents repository, which wraps the Gemini Interactions API in a more manageable package.

What This Does

The ia-agents repo offers a minimalistic agent framework designed to simplify the creation and management of agents. Key files include packages/agent/src/index.ts and packages/agents-core/src/index.ts, where the core logic resides. The framework features a Streaming Agent Loop that supports multi-modal interactions. It uses a hooks system to allow you to intercept lifecycle events—check out packages/agent/src/hooks/index.ts for the available hooks.

Tool calling is straightforward; you define tools in JSON Schema, and the framework executes them. If you want to block specific commands (like rm -rf), the beforeToolExecute hook lets you do just that. Check out the example in examples/agent-with-hooks.ts for a practical use case.

Real-World Use

Imagine you're developing a chat application that needs to execute user commands but also filter out dangerous ones. You can set up an agent using the createAgentSession method from @philschmid/agent, register your tools, and implement a blocking mechanism for harmful commands. Here's a quick example:

const session = createAgentSession({ model: 'gemini-3-flash-preview', tools: ['read', 'bash'], });

session.on('beforeToolExecute', (event) => { if (event.toolName === 'bash' && event.arguments.command.includes('rm -rf')) { return { allow: false, reason: 'Destructive command blocked' }; } return { allow: true }; });

The Bottom Line

ia-agents is a solid choice for developers looking to build intelligent agents without the headache of handling everything from scratch. The modular approach with agents-core and agent packages allows for flexibility, but you might find it overkill for simple projects. If you need a lightweight solution with powerful capabilities, give it a shot. Just be ready to dive into TypeScript if you’re not already familiar.