Skip to content

Using the Functions Agent

The left panel of the function editor is an AI agent chat. The agent writes serverless function code for you — describe what you want, and it builds or modifies your function.

The functions agent chat with metadata chips and code panel

  • Write new functions from scratch — describe the behavior and the agent creates the full implementation
  • Modify existing code — ask for changes and the agent updates your function
  • Integrate with APIs — the agent can write code that calls HubSpot, Slack, Stripe, or any external API
  • Read your CRM schema — the agent has access to your portal’s schema files, so it uses the correct property names and pipeline IDs
  • Reference HubSpot API specs — the agent knows the HubSpot API, so it writes correct API calls without guessing

The agent has two modes, toggled above the chat input:

  • Build — the agent writes code directly. Best for straightforward tasks.
  • Plan — the agent analyzes the request and proposes a plan before making changes. Best for complex functions. Click Implement Plan when satisfied.

Type your message in the input at the bottom and press Enter or click the send button. The agent will analyze your request, read relevant files, and write the code.

You can attach images to your messages — useful for sharing API documentation screenshots, architecture diagrams, or error messages from external services.

Your conversation history is preserved as you navigate. Scroll up to review previous messages. The agent retains context from earlier prompts, so you can iterate without repeating yourself.

Unsent messages are auto-saved between sessions. Navigate away or close the browser — your draft will be waiting when you return.

The agent will never hardcode API keys, tokens, or passwords in your code. If your function needs a secret, the agent will:

  1. Add the secret name to the Env interface in your code
  2. Reference it as env.SECRET_NAME
  3. Ask you to create the secret in the Secrets tab

If you paste a secret value in the chat, the agent will refuse it and redirect you to the Secrets tab.