r/learnpython 15h ago

Best Python libraries or tools for testing AI agents that call external APIs

Using LangChain to build an agent that calls Stripe, Slack and HubSpot. Unit testing the individual functions is fine but integration testing the full agent behavior feels impossible. Every time we think we've covered the cases something new breaks in prod. What tools are people using?

0 Upvotes

2 comments sorted by

1

u/cyrixlord 14h ago

ask the llm how it would make tests for these api test points and test for these query subject including ones outside the scope of the bot

1

u/vietbaoa4htk 12h ago

vcrpy or pytest-recording to record the real stripe/slack calls once and replay them as cassettes, respx if youre on httpx. the thing that actually catches prod breaks though is asserting on the sequence of tool calls the agent made, not on the final text.