Esquema de Firestore
Referencia del esquema de Firestore para integraciones con Firebase.
Colecciones Principales
Colección: agents
agents/
├── {agentId}/
│ ├── name: string
│ ├── description: string
│ ├── systemPrompt: string
│ ├── model: string
│ ├── visibility: "private" | "organization" | "public"
│ ├── organizationId: string
│ ├── createdBy: string
│ ├── createdAt: timestamp
│ ├── updatedAt: timestamp
│ └── metadata: object
Colección: spaces
spaces/
├── {spaceId}/
│ ├── name: string
│ ├── description: string
│ ├── organizationId: string
│ ├── visibility: "private" | "organization" | "public"
│ ├── createdAt: timestamp
│ ├── updatedAt: timestamp
│ └── s3Prefix: string
Colección: missions
missions/
├── {missionId}/
│ ├── name: string
│ ├── agentId: string
│ ├── spaceId: string
│ ├── frequency: string
│ ├── status: "active" | "paused"
│ ├── nextRun: timestamp
│ └── instructions: string
Colección: executions
executions/
├── {executionId}/
│ ├── agentId: string
│ ├── missionId: string
│ ├── status: "completed" | "failed" | "in_progress"
│ ├── message: string
│ ├── usage: {inputTokens, outputTokens}
│ ├── startedAt: timestamp
│ └── completedAt: timestamp
Reglas de Firestore
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /agents/{agentId} {
allow read, write: if request.auth.uid == resource.data.createdBy;
}
match /spaces/{spaceId} {
allow read, write: if request.auth.uid in resource.data.members;
}
}
}
Índices Recomendados
agents.organizationId, agents.createdAtspaces.organizationId, spaces.visibilityexecutions.agentId, executions.createdAt
Próximos Pasos
- Lee SDKs
- Explora API de Agentes