HTTPS Integration
Learn how to test agents deployed as HTTP/HTTPS services
Test agents deployed as HTTP/HTTPS endpoints through Scenario's AgentAdapter[ts][py] interface. This enables blackbox testing of production-deployed agents with real infrastructure.
HTTPS integration is ideal when your agent is deployed as a web service, microservice, or serverless function. The adapter makes HTTP requests to your endpoint, testing the complete production stack.
Basic Integration Pattern
typescript
import scenario, { AgentAdapter, AgentRole } from "@langwatch/scenario";
const httpsAgentAdapter: AgentAdapter = {
role: AgentRole.AGENT,
call: async (input) => {
// Extract the latest user message
const lastMessage = input.messages[input.messages.length - 1];
const content =
typeof lastMessage.content === "string"
? lastMessage.content
: (lastMessage.content.find((part) => part.type === "text") as any)
?.text || "";
// Make HTTPS request to your agent
const response = await fetch("https://your-agent.com/api/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.API_KEY}`,
},
body: JSON.stringify({
message: content,
thread_id: input.thread_id,
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const result = await response.json();
return result.response; // Adjust to match your API's response structure
},
};
// Use in your test
await scenario.run({
agents: [scenario.userSimulatorAgent(), httpsAgentAdapter],
// ... scenario configuration
});Next Steps
- Explore Testing Remote Agents for advanced HTTP patterns (streaming, SSE, authentication, error handling)
- Learn about Scripted Simulations for precise control
- Check out Scenario Basics for advanced testing patterns
- Review more Agent Integration patterns for other frameworks
