this is my handler setup in copoilotkit ``` const openApi = new OpenAI({ apiKey: this.apiKey, }) const serviceAdapter = new OpenAIAdapter({ openai: openApi }) const agents = MastraAgent.getLocalAgents({ mastra: this.mastraService.getMastraInstance(), }) this.runtime = new CopilotRuntime({ agents, }) this.logger.debug('CopilotKit agents: %o', Object.keys(agents)) this.handler = copilotRuntimeNestEndpoint({ runtime: this.runtime, serviceAdapter, endpoint: '/copilotkit', logLevel: 'debug', }) ``` This is my mastra setup: ``` this.mastra = new Mastra({ agents: Object.fromEntries( Array.from(this.agents.values()).map((agentRegistration) => [agentRegistration.name, agentRegistration.agent]), ), storage: new PostgresStore({ host: dbConfig.host, port: dbConfig.port, database: dbConfig.database, user: dbConfig.username, password: dbConfig.password, ssl: dbConfig.ssl?.rejectUnauthorized === false ? false : undefined, }) as unknown as MastraStorage, logger: new MastraLoggerWrapper(this.logger), }) ``` This is how i define my agent: ``` export interface NLBIContext { tenantId: string projectId: string userId: string } return new Agent({ name: NLBI_AGENT_NAME, instructions: async ({ runtimeContext }: { runtimeContext: RuntimeContext }) => { const typedContext: RuntimeContext = runtimeContext as RuntimeContext const tenantId = typedContext.get('tenantId') const projectId = typedContext.get('projectId') ```