AutoGPT/rnd/autogpt_server/schema.prisma

125 lines
4.3 KiB
Plaintext

datasource db {
provider = "sqlite"
url = "file:./database.db"
}
generator client {
provider = "prisma-client-py"
recursive_type_depth = 5
interface = "asyncio"
}
// This model describes the Agent Graph/Flow (Multi Agent System).
model AgentGraph {
id String @id
name String?
description String?
startingAgentNodeId String
StartingAgentNode AgentNode @relation("AgentGraphRoot", fields: [startingAgentNodeId], references: [id])
AgentNodes AgentNode[] @relation("AgentGraphNodes")
}
// This model describes a single node in the Agent Graph/Flow (Multi Agent System).
model AgentNode {
id String @id
agentBlockId String
AgentBlock AgentBlock @relation(fields: [agentBlockId], references: [id])
agentGraphId String
AgentGraph AgentGraph @relation("AgentGraphNodes", fields: [agentGraphId], references: [id])
// List of consumed input, that the parent node should provide.
Input AgentNodeLink[] @relation("AgentNodeInput")
// List of produced output, that the child node should be executed.
Output AgentNodeLink[] @relation("AgentNodeOutput")
ExecutionHistory AgentNodeExecution[]
// Prisma requires explicit back-references.
ReferencedByAgentGraphAsRoot AgentGraph[] @relation("AgentGraphRoot")
}
// This model describes the link between two AgentNodes.
model AgentNodeLink {
id String @id
agentNodeInputId String
AgentNodeInput AgentNode @relation("AgentNodeOutput", fields: [agentNodeInputId], references: [id]) // Output of the node is the input of the link.
agentNodeInputSchemaId String
AgentNodeInputSchema AgentBlockInputOutput @relation("AgentNodeInputSchema", fields: [agentNodeInputSchemaId], references: [id])
agentNodeOutputId String
AgentNodeOutput AgentNode @relation("AgentNodeInput", fields: [agentNodeOutputId], references: [id]) // Input of the node is the output of the link.
agentNodeOutputSchemaId String
AgentNodeOutputSchema AgentBlockInputOutput @relation("AgentNodeOutputSchema", fields: [agentNodeOutputSchemaId], references: [id])
}
// This model describes a component that will be executed by the AgentNode.
model AgentBlock {
id String @id
name String @unique
// We allow a block to have multiple types of output.
Input AgentBlockInputOutput[] @relation("AgentBlockInput")
Output AgentBlockInputOutput[] @relation("AgentBlockOutput")
// Prisma requires explicit back-references.
ReferencedByAgentNode AgentNode[]
}
// This model describes the output (produced event) or input (consumed event) of an AgentBlock.
model AgentBlockInputOutput {
id String @id
name String
schema String
description String
// Prisma requires explicit back-references.
ReferencedByAgentBlockInput AgentBlock[] @relation("AgentBlockInput")
ReferencedByAgentBlockOutput AgentBlock[] @relation("AgentBlockOutput")
ReferencedByAgentNodeLinkAsInput AgentNodeLink[] @relation("AgentNodeInputSchema")
ReferencedByAgentNodeLinkAsOutput AgentNodeLink[] @relation("AgentNodeOutputSchema")
ReferencedByAgentNodeExecution AgentNodeExecution[]
}
// This model describes the execution of an AgentNode.
model AgentNodeExecution {
id String @id
agentNodeId String
AgentNode AgentNode @relation(fields: [agentNodeId], references: [id])
inputData String
inputFiles FileDefinition[] @relation("InputFiles")
outputData String
outputFiles FileDefinition[] @relation("OutputFiles")
outputTypeId String?
outputType AgentBlockInputOutput? @relation(fields: [outputTypeId], references: [id])
// sqlite does not support enum
// enum Status { STARTED, RUNNING, SUCCESS, FAILED }
executionStatus String
// JSON serialized object of the execution state: information required to resume the execution.
executionStateData String
}
// This model describes a file that can be used as input/output of an AgentNodeExecution.
model FileDefinition {
id String @id
path String
metadata String? // JSON serialized object
mimeType String?
size Int?
hash String?
encoding String?
// Prisma requires explicit back-references.
ReferencedByInputFiles AgentNodeExecution[] @relation("InputFiles")
ReferencedByOutputFiles AgentNodeExecution[] @relation("OutputFiles")
}