Invoke a deepagent with a user query and optional pre-seeded files, returning a structured AgentTrajectory for assertions.
Each call creates a fresh thread (random UUID) so tests are fully
isolated. Inputs and outputs are logged to LangSmith via
ls.logOutputs() so they appear in the experiment UI.
runAgent(agent: ReactAgent<any>, params: __type): Promise<AgentTrajectory>| Name | Type | Description |
|---|---|---|
agent* | ReactAgent<any> | A compiled deepagent (from createDeepAgent or the shared agent export). |
params* | __type |
const result = await runAgent(agent, {
query: "Read /data.txt and reverse the lines into /out.txt.",
initialFiles: { "/data.txt": "alpha\nbeta\ngamma\n" },
});
expect(result).toHaveAgentSteps(3);
expect(result.files["/out.txt"].trimEnd().split("\n"))
.toEqual(["gamma", "beta", "alpha"]);