feat(agent): IMicroAgenticaConfig.throw - #517
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a configurable error handling mechanism to the MicroAgentica agent framework. Users can now control whether execution failures should throw exceptions or be handled silently through a new throw configuration option.
- Adds a
throwproperty toIMicroAgenticaConfigfor controlling error handling behavior - Implements
assertExecuteFailureutility function to throw errors when execution fails - Updates documentation with usage examples and guidance on the new error handling feature
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/core/src/structures/IMicroAgenticaConfig.ts |
Adds the throw configuration property with comprehensive JSDoc documentation |
packages/core/src/utils/assertExecuteFailure.ts |
New utility function that throws appropriate errors based on execution history failure types |
packages/core/src/MicroAgentica.ts |
Integrates error assertion into the conversate flow and refactors describe agent condition check |
packages/core/src/structures/IMicroAgenticaExecutor.ts |
Adds @default false annotation to the describe property documentation |
website/content/docs/core/micro.mdx |
Adds comprehensive Error Handling section with code examples and usage guidance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @param ctx Context of the agent | ||
| * @param executes List of function calling results | ||
| * @returns List of prompts generated by the describer | ||
| * @default false |
There was a problem hiding this comment.
The @default false annotation is misleading. The describe property is optional (can be undefined), and when not provided, it defaults to undefined, not false. The behavior in the actual implementation (line 177 in MicroAgentica.ts) treats undefined differently from false. Consider removing this annotation or clarifying that the default is "not set" or "undefined".
| * @param ctx Context of the agent | |
| * @param executes List of function calling results | |
| * @returns List of prompts generated by the describer | |
| * @default false | |
| * When this property is not provided, it is treated as not set | |
| * (`undefined`), which may be handled differently from `false`. | |
| * | |
| * @param ctx Context of the agent | |
| * @param executes List of function calling results | |
| * @returns List of prompts generated by the describer | |
| * @default undefined (not set) |
This pull request introduces a configurable error handling mechanism to the
MicroAgenticaagent framework, allowing users to choose whether execution failures should throw exceptions or be handled silently. The main changes include the addition of athrowoption in the agent configuration, implementation of the error assertion logic, and documentation updates to guide users on this new behavior.Error handling improvements:
throwproperty to theIMicroAgenticaConfiginterface, allowing users to specify if exceptions should be thrown on execution failure.assertExecuteFailureutility function inassertExecuteFailure.tsto throw errors when execution fails, and integrated it into the main agent execution flow inMicroAgentica.ts. [1] [2] [3]Documentation updates:
micro.mdxto explain the new error handling behavior, provide usage examples, and reference the newthrowoption.describeproperty inIMicroAgenticaExecutor.