-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathagent.ts
More file actions
24 lines (22 loc) · 753 Bytes
/
Copy pathagent.ts
File metadata and controls
24 lines (22 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import {
type LanguageModel,
stepCountIs,
type ToolLoopAgentSettings,
type ToolSet,
} from "ai";
type AgentContext = {
model: (id: string) => LanguageModel;
mcp: { tools: (server: string) => Promise<ToolSet> };
respond: (
settings: ToolLoopAgentSettings<never, ToolSet>,
) => Promise<Response>;
};
export default async function agent({ model, mcp, respond }: AgentContext) {
return respond({
model: model("openai/gpt-5.4-nano"),
instructions:
"You are a helpful assistant with Pollinations MCP tools. Use tools when needed; report their real results and include generated media links.",
tools: await mcp.tools("pollinations"),
stopWhen: stepCountIs(5),
});
}