Skip to content

Access tool call items in an output guardrail #713

@jonjomckay

Description

@jonjomckay

Is it possible to check which tools were called, and their inputs/outputs in a guardrail? My use case is as follows:

  1. The user creates an "agent" entity in our platform, configured to look at person-1 and person-2
  2. Our platform runs an Agent using this SDK, telling it to use the queryPerson tool through MCP with the IDs person-1 and person-2
  3. We receive results for both people

I'd like to ensure that the agent did in fact call the queryPerson tool, with person-1 and person-2 as parameters. This does happen 99% of the time, as we're explicitly telling the LLM to, but there are occasions where it doesn't and it seems like an output guardrail might be the appropriate place to catch this (and e.g. retry the agent, or return an error).

I have stepped through the parameters passed to my OutputGuardrail.execute function, but I can't seem to find any of the tool calls. They do appear in the result from the run function though, but it's too late to be used in a guardrail by then.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions