Overview

This guide will help you understand how to effectively develop agents with Magma. We recommend exploring the Magma Basics first, to get a better understanding of the different features and capabilities of Magma.

Debugging

Remember, console.log is your friend. You can use it in any tool, middleware, hooks, job or agent method to help you debug your agent.

Testing

Use magma run to test your agent locally. This will start the agent in a development environment, and output the agent’s logs directly to the console as you interact with the agent.

Hooks

Tools like Postman and ngrok are great for testing hooks.

You can use Postman to send requests to your agent, and ngrok to expose your local server to the internet to test hooks from external sources.

The hook endpoint for your agent locally is

http://localhost:3000/v1/agents/<agent-id>/hooks/<hook-name>

You can find your agent’s id in the .magma/.cache file.

If you don’t see an agent id, you can use the magma save command to generate one.

magma save

For some examples of hooks, try walking through the Slack DM template.