Agents
Your First Agent
Learn how to define and run agents in Inferable.
Agents are defined and triggered as code, in a workflow.
Unless you’re going for more advanced use cases, you’ll likely only need to define an agent within the context of a workflow.
Defining an Agent
Agents are defined as code, in a workflow. They have 3 main fields:
- Name: The name of the agent. This is used to identify the agent in the workflow.
- System Prompt: The system prompt that the agent will use to achieve its goal.
- Result Schema (optional): The schema of the result that the agent will return. This could be a zod object (only in Typescript), or a JSON schema.
Running an Agent
Agents are run by calling the run
method. This method will asynchronously execute the agent. The result is a JSON object that matches the resultSchema
of the agent.
If the agent can’t satisfy its result schema, it will throw an exception at the point of the failure, so that the workflow doesn’t continue.
We will cover more about agent failure modes in the workflow section.
Was this page helpful?