Running Your First Agent

This section will walk you through creating and running your first agent to interact with a webpage.

Create an Agent

To onboard a new agent, you can make a direct HTTP POST request to Assisfy's API. The endpoint to create an agent is:

POST https://api.assisfy.ai/agent/onboard

Request Headers

  • Authorization: Bearer {API_KEY} (your Assisfy API Key)

  • Content-Type: application/json

Request Body

The payload should include the following fields:

  • name: A unique name for your agent.

  • website: The primary website your agent will interact with.

  • domain: The purpose of your agent. Choose from sales, marketing, research, automation, or podcasting.

Code Example (JavaScript)

Here’s how you can onboard an agent using the fetch API:

const createAgent = async () => {
  const response = await fetch("https://api.assisfy.ai/agent/onboard", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.ASSISFY_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "My First Agent",
      website: "https://example.com",
      domain: "research", // Options: sales, marketing, research, automation, podcasting
    }),
  });

  if (!response.ok) {
    console.error("Failed to create agent:", response.statusText);
    return;
  }

  const data = await response.json();
  console.log("Agent created successfully:", data);
};

createAgent();

Sample Response

{
  "agentId": "agent_12345",
  "name": "My First Agent",
  "website": "https://example.com",
  "domain": "research"
}

Response Fields

  • agentId: Unique identifier for the newly created agent.

  • name: The name of the agent.

  • website: The primary website assigned to the agent.

  • domain: The agent's specified domain.

  • apiKey: The API Key to use for this specific agent.

Notes

  • Save the apiKey provided in the response for future requests. This is specific to the created agent.

  • Ensure your API Key is stored securely to avoid unauthorized access.


Now you can use this newly created agent for initializing sessions, managing actions, and leveraging Assisfy’s capabilities! For further steps, proceed to Initialize a Session.

Last updated