CODEX_ADK/BACKEND/Codex.Dal/Entities/AgentExecution.cs
jean-philippe 3fae2fcbe1 Initial commit: CODEX_ADK (Svrnty Console) MVP v1.0.0
This is the initial commit for the CODEX_ADK project, a full-stack AI agent
management platform featuring:

BACKEND (ASP.NET Core 8.0):
- CQRS architecture with 6 commands and 7 queries
- 16 API endpoints (all working and tested)
- PostgreSQL database with 5 entities
- AES-256 encryption for API keys
- FluentValidation on all commands
- Rate limiting and CORS configured
- OpenAPI/Swagger documentation
- Docker Compose setup (PostgreSQL + Ollama)

FRONTEND (Flutter 3.x):
- Dark theme with Svrnty branding
- Collapsible sidebar navigation
- CQRS API client with Result<T> error handling
- Type-safe endpoints from OpenAPI schema
- Multi-platform support (Web, iOS, Android, macOS, Linux, Windows)

DOCUMENTATION:
- Comprehensive API reference
- Architecture documentation
- Development guidelines for Claude Code
- API integration guides
- context-claude.md project overview

Status: Backend ready (Grade A-), Frontend integration pending

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 18:32:38 -04:00

111 lines
3.0 KiB
C#

using Codex.Dal.Enums;
namespace Codex.Dal.Entities;
/// <summary>
/// Represents a single execution of an agent, tracking performance, tokens, and tool usage.
/// </summary>
public class AgentExecution
{
/// <summary>
/// Unique identifier for this execution
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Foreign key to the agent that was executed
/// </summary>
public Guid AgentId { get; set; }
/// <summary>
/// Foreign key to the conversation (if part of a conversation). Nullable for standalone executions.
/// </summary>
public Guid? ConversationId { get; set; }
/// <summary>
/// The user's input prompt
/// </summary>
public string UserPrompt { get; set; } = string.Empty;
/// <summary>
/// Additional input context or parameters (stored as JSON if needed)
/// </summary>
public string? Input { get; set; }
/// <summary>
/// The agent's generated output/response
/// </summary>
public string Output { get; set; } = string.Empty;
/// <summary>
/// When the execution started
/// </summary>
public DateTime StartedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// When the execution completed (null if still running)
/// </summary>
public DateTime? CompletedAt { get; set; }
/// <summary>
/// Total execution time in milliseconds
/// </summary>
public long? ExecutionTimeMs { get; set; }
/// <summary>
/// Number of tokens in the input/prompt
/// </summary>
public int? InputTokens { get; set; }
/// <summary>
/// Number of tokens in the output/response
/// </summary>
public int? OutputTokens { get; set; }
/// <summary>
/// Total tokens used (input + output)
/// </summary>
public int? TotalTokens { get; set; }
/// <summary>
/// Estimated cost in USD (null for Ollama/local models)
/// </summary>
public decimal? EstimatedCost { get; set; }
/// <summary>
/// Tool calls made during execution (stored as JSON array)
/// </summary>
public string? ToolCalls { get; set; }
/// <summary>
/// Results from tool executions (stored as JSON array for debugging)
/// </summary>
public string? ToolCallResults { get; set; }
/// <summary>
/// Current status of the execution
/// </summary>
public ExecutionStatus Status { get; set; } = ExecutionStatus.Running;
/// <summary>
/// Error message if execution failed
/// </summary>
public string? ErrorMessage { get; set; }
// Navigation properties
/// <summary>
/// The agent that was executed
/// </summary>
public Agent Agent { get; set; } = null!;
/// <summary>
/// The conversation this execution belongs to (if applicable)
/// </summary>
public Conversation? Conversation { get; set; }
/// <summary>
/// Messages generated during this execution
/// </summary>
public ICollection<ConversationMessage> Messages { get; set; } = new List<ConversationMessage>();
}