Composio 0.27.0

0.27.0
Added 4
  • Session hooks that can block a tool call before it runs or block its result before the agent sees it
  • The create() and update() methods accept a hooks option; on update(), hooks replaces the whole list and null removes every hook
  • Blocked tool calls return resultType 'blocked' with empty data, the hook's message in error, and blockReason from session.execute() and session.executeMeta()
  • Results include hookResults when a hook applied
Changed 2

1 change to check, marked in the notes below

From Composio

Minor Changes
  • c2bbfa8: Add session hooks. A hook can block a tool call before it runs, or block its result before the agent sees it.

    create() and update() accept hooks. On update(), hooks replaces the whole list and null removes every hook. hooks cannot be combined with experimental.sessionConfigId.

    const session = await composio.create('user_123', {
      hooks: [
        {
          type: 'before_execute',
          id: 'no_external_email',
          name: 'No external email',
          appliesTo: { toolkits: ['gmail'] },
          handler: {
            type: 'condition_check',
            condition: 'Sending email to anyone outside example.org',
            action: 'block',
          },
        },
      ],
    });
    

    A blocked call comes back from session.execute() and session.executeMeta() with resultType: 'blocked', empty data, the hook's message in error, and blockReason. Provider integrations hand it to the agent as a failed call with that message. Every result also carries hookResults when a hook applied.

    session.proxyExecute() and ctx.proxyExecute() now return resultType: 'completed' or resultType: 'blocked'. A blocked request has no HTTP response, so TypeScript code that reads status has to check resultType first. signature changed · inferred

View original

Upgraded? How did it go?

Discussion