Skip to main content
If you’re building an agent, we recommend using sessions instead. See Tools and toolkits for how sessions handle tool discovery and execution automatically.
After execution modifiers are part of Composio SDK’s powerful middleware capabilities that allow you to customize and extend the behavior of tools. These modifiers are called after the tool is executed. 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
  • Converting the output to a different format before returning it to the agent
After Execution Modifier
Below we use the afterExecute modifier to truncate the output of HACKERNEWS_GET_USER and only return the karma of the user.

With Chat Completions

Since completion providers don’t have a function execution step, Composio executes the tool call directly. The modifier is configured on the tools.execute method.

With Agentic Frameworks

Agentic providers have a function execution step. The modifier is configured on the tools.get method which modifies the execution logic within the framework.

Next

Before execution modifiers