ワンクリックで
test-agent
Test an agentick agent with mock model responses. Use when asked to write tests, test an agent, or verify agent behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Test an agentick agent with mock model responses. Use when asked to write tests, test an agent, or verify agent behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create a new agentick tool using createTool. Use when asked to add a tool, create a tool, or implement tool functionality.
Add a new package to the agentick monorepo. Use when creating a new @agentick/* package.
Create a new agentick lifecycle hook or custom hook. Use when asked to add a hook, create reactive behavior, or implement lifecycle logic.
Build, typecheck, and test the agentick monorepo. Use when asked to verify changes, run checks, or ensure nothing is broken.
Create a new model adapter for agentick. Use when asked to add support for a new model provider (Anthropic, Mistral, Cohere, etc).
Create a new agentick JSX component. Use when asked to add a component, create a UI primitive, or build a reusable agent building block.
| name | test-agent |
| description | Test an agentick agent with mock model responses. Use when asked to write tests, test an agent, or verify agent behavior. |
Agentick provides testing utilities in @agentick/core/testing for testing agents without real API calls.
import { createTestAdapter } from "@agentick/core/testing";
// Simple text response
const adapter = createTestAdapter({ defaultResponse: "Hello!" });
// Scripted tool calls
adapter.respondWith([{ tool: { name: "search", input: { query: "test" } } }]);
// Sequence of responses
adapter.respondWith("First response");
adapter.respondWith("Second response");
// Responses are consumed in order; falls back to defaultResponse after
import { describe, it, expect, afterEach } from "vitest";
import { createApp } from "@agentick/core";
import { createTestAdapter, cleanup } from "@agentick/core/testing";
describe("MyAgent", () => {
afterEach(() => cleanup());
it("responds to messages", async () => {
const adapter = createTestAdapter({ defaultResponse: "I can help!" });
const app = createApp(() => (
<>
<Model model={adapter} />
<System>You are helpful.</System>
<MyTool />
<Timeline />
</>
));
const result = await app.run({
messages: [{ role: "user", content: [{ type: "text", text: "Hi" }] }],
}).result;
expect(result.response).toBe("I can help!");
});
it("handles tool calls", async () => {
const adapter = createTestAdapter({ defaultResponse: "Done." });
adapter.respondWith([
{ tool: { name: "my_tool", input: { action: "add", text: "item" } } },
]);
const app = createApp(() => (
<>
<Model model={adapter} />
<System>You manage items.</System>
<MyTool />
<Timeline />
</>
));
const result = await app.run({
messages: [{ role: "user", content: [{ type: "text", text: "Add an item" }] }],
}).result;
// First tick: tool call. Second tick: "Done." response.
expect(result.response).toBe("Done.");
});
});
it("maintains state across messages", async () => {
const adapter = createTestAdapter({ defaultResponse: "ok" });
const app = createApp(MyAgent);
const session = await app.session({ id: "test-session" });
// First message
await session.send({
messages: [{ role: "user", content: [{ type: "text", text: "Hello" }] }],
}).result;
// Second message (same session)
const result = await session.send({
messages: [{ role: "user", content: [{ type: "text", text: "Remember me?" }] }],
}).result;
expect(result).toBeDefined();
});
For testing code that consumes sessions (gateways, middleware):
import { createMockApp, createMockSession } from "@agentick/core/testing";
const app = createMockApp();
const session = createMockSession();
For testing code that consumes procedures:
import { createTestProcedure } from "@agentick/kernel/testing";
const proc = createTestProcedure({
handler: (input: string) => `processed: ${input}`,
});
const result = await proc("hello").result;
expect(result).toBe("processed: hello");
expect(proc._callCount).toBe(1);
expect(proc._lastArgs).toEqual(["hello"]);
packages/core/src/testing/test-adapter.tspackages/core/src/testing/mock-app.tspackages/core/src/testing/render-agent.tspackages/core/src/testing/async-helpers.tspackages/core/src/testing/index.tspnpm test # All tests
pnpm --filter @agentick/core test # Core tests only
pnpm vitest run path/to/file.spec.ts # Single file
pnpm vitest --watch # Watch mode