Skip to main content
Members of your organisation can create new playground sessions by clicking on “Create Session” button. However, your session might require some metadata to be properly created. You can provide a custom form by setting newSessionComponent property:
export default defineConfig({
  agents: [
    {
      name: "weather-chat",
      metadata: {
        userLocation: z.string()
      },
      newSessionComponent: ({ submit, isRunning }) => {
        return <div>
          <Input type="text" placeholder="Enter your location" />
          <Button type="submit" disabled={isRunning}>Create Session</Button>
        </div>
      }
    }
  ]
})
submit function takes 2 properties:
PropDescriptionType
submitA function creates new session with proper metadata(values: { metadata?: Record<string, any> }) => void
isRunningtrue if session is being createdboolean
When you call it and session is created successfully it will redirect user to the session page.