Tool input guardrail
FreshCtx + OpenAI Agents SDK
Use openai_agents_tool_guardrail() as a tool input guardrail on a custom SDK function tool.
What FreshCtx protects
FreshCtx validates the declared dependencies immediately before the SDK invokes a custom function tool body. Stale or unverifiable evidence becomes the SDK's native ToolInputGuardrailTripwireTriggered.
Where the pre-action boundary sits
The boundary sits in the SDK's tool input guardrail stage. The SDK supplies the tool name and tool-call ID; the exception's output.output_info["freshctx"] carries the FreshCtx check result.
Limitations
- Covers custom function_tool calls only. The SDK does not apply tool guardrails to hosted tools, built-in execution tools, handoffs, or Agent.as_tool().
- FreshCtx does not own model selection, tool selection, approvals, retries, handoffs, transactions, or idempotency.
- Raw tool arguments are not copied into FreshCtx metadata or audit evidence.
Installation
python -m pip install 'freshctx[openai-agents]==0.9.0'Minimal example
from agents import function_tool
from freshctx.integrations.openai_agents import openai_agents_tool_guardrail
freshness = openai_agents_tool_guardrail(depends_on=[decision], store=store)
@function_tool(tool_input_guardrails=[freshness])
async def write_record(record_id: str) -> str:
"""Write one record."""
return record_idContinue
Third-party names and logos are trademarks of their respective owners. Their appearance identifies compatible integration surfaces and does not imply endorsement or partnership.