After Execution Modifiers
Learn how to use after execution modifiers to transform tool results after execution.
After execution modifiers are part of Composio SDK’s powerful middleware capabilities that allow you to customize and extend the behavior of tools.
After Execution Modifiers
These modifiers are called after the tool is executed by the LLM. This allows you to modify the result of the tool before it is returned to the agent.
Useful for:
- Modifying or truncating the output of the tool.
- Convert the output to a different format before returning it to the agent.

Below we use the afterToolExecute
modifier to truncate the output of the HACKERNEWS_GET_USER
tool and only return the karma of the user.
With Chat Completions
With Agentic Frameworks
Since completion providers don’t have a function execution step — Composio will execute the tool call directly.
Hence, the modifier is configured on the tools.execute
method.