https://linen.dev logo
Struggling to get the agent to work
# 🖥│support-forum
p
I'm really struggling to get the agent to work. Any help with this? I have tried with mastra, I have tried with Vercel SDK with no success. Here's what I've got.
Copy code
import { createOpenAI } from "@ai-sdk/openai";
import { Composio } from "@composio/core";
import { MastraProvider } from "@composio/mastra";
import { Agent } from "@mastra/core/agent";
// import { openai } from "@ai-sdk/openai";


const COMPOSIO_API_KEY = "";
const OPENAI_API_KEY = "";
const OPENAI_BASE_URL = "https://openrouter.ai/api/v1";
const MODEL = "gpt-5.2";
const AGENT_ID = "44781183"; // same as user id on composio dashboard
const TOOLKITS = ["googlecalendar"];
const PROMPT = "Do I have any booking on my Google Calendar for tomorrow? If so, list the events and their times. Timezone is Africa/Lagos.";


const composio = new Composio({
    provider: new MastraProvider(),
    apiKey: COMPOSIO_API_KEY,
});

const openai = createOpenAI({
    apiKey: OPENAI_API_KEY,
    baseURL: OPENAI_BASE_URL,
});

// Create a session for your user
const session = await composio.create(AGENT_ID, { toolkits: TOOLKITS });
const tools = await session.tools({ toolkits: TOOLKITS });

const agent = new Agent({
    id: "my-agent",
    name: "My Agent",
    instructions: "You are a helpful assistant.",
    model: openai(MODEL),
    tools,
});

const { text } = await agent.generate([
    { role: "user", content: PROMPT },
]);

console.log(text);
`
Any help with this? It would claim to not have access to the google calendar. Can you help with this please ?
I also tried with Vercel SDK, here's the code:
Copy code
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
import { Composio } from "@composio/core";
import { VercelProvider } from "@composio/vercel";
import { generateText, stepCountIs } from "ai";
import { createOpenAI } from "@ai-sdk/openai";


const COMPOSIO_API_KEY = "ak_l_";
const OPENAI_API_KEY = "sk-or-v1-";
const OPENAI_BASE_URL = "https://openrouter.ai/api/v1";
const MODEL = "claude-opus-4-6"; // also tried antropic/claude-opus-4-6
const AGENT_ID = "44781183";
const TOOLKITS = ["googlecalendar"];
const PROMPT = "Do I have any booking on my Google Calendar for tomorrow? If so, list the events and their times. Timezone is Africa/Lagos.";


const composio = new Composio({
    provider: new VercelProvider(),
    apiKey: COMPOSIO_API_KEY,
});


const openai = createOpenAI({
    apiKey: OPENAI_API_KEY,
    baseURL: OPENAI_BASE_URL,
});

const anthropicClient = createAnthropic({
    apiKey: OPENAI_API_KEY,
    baseURL: OPENAI_BASE_URL,
});


// Create a session for your user
const session = await composio.create(AGENT_ID, { toolkits: TOOLKITS });
const tools = await session.tools({ toolkits: TOOLKITS });

const { text } = await generateText({
    model: anthropicClient(MODEL),
    tools,
    prompt: PROMPT,
    stopWhen: stepCountIs(10),
});

console.log(text);
Any help with this.
@Uday Any help with this? Been waiting for days.
u
Hey @paschal, sorry for the delay here. Let me check and revert back.
Hey @paschal, I just tried the Mastra provider snippet and it seems to be working fine. Could you make sure your SDK packages are updated? Thanks! https://cdn.discordapp.com/attachments/1486019340305301729/1486963981917618256/Screenshot_2026-03-27_at_11.12.33.png?ex=69c76a9f&is=69c6191f&hm=a28d8d36eb8b8fe3f13831e72fd724d59935e08d7c59fa5d88586769ebfa21cd&
p
Same issue, I was on version 0.6.6, but I upgraded to 0.6.7.
Copy code
"@composio/core": "^0.6.7",
    "@composio/mastra": "^0.6.7",
    "@composio/vercel": "^0.6.7",
When I run it, I get the error:
Copy code
I can’t check your Google Calendar directly right now because the Calendar tool I use to read events is erroring in this environment (it fails before I can even authenticate or query your events). So I’m unable to reliably list your bookings for tomorrow from here.
Can you help please? We've been stuck at this for a week now.
Generally getting error messages implying it is unable to access the tools, variants of things like:
Copy code
I can’t check your Google Calendar right now because the Calendar tool connection/search is failing on my side (an integration/schema validation error), so I’m unable to fetch your events directly.
Could it be because we use openrouter?
@Uday Any help with this? I still get error variants of the below:
Copy code
I can check, but my Google Calendar tool lookup call failed due to a backend schema/validation error, so I can’t access your calendar right now from here.
@Uday Any help with this yet?
u
Hey @paschal, sorry missed this! it worked fine with openrouter on my end(1st snippet). Could you share the exact error from the tool? you can use
export COMPOSIO_LOG_LEVEL=debug
in your terminal to get complete network logs.
@Uday Please help.
b
Check if the Google Calendar toolkit is active in your dashboard
2 Views