Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sirji's Extendable AI Agentic Framework Architecture #87

Open
kedarchandrayan opened this issue Apr 19, 2024 · 0 comments
Open

Sirji's Extendable AI Agentic Framework Architecture #87

kedarchandrayan opened this issue Apr 19, 2024 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@kedarchandrayan
Copy link
Member

kedarchandrayan commented Apr 19, 2024

Sirji is an AI agentic framework designed as a VS Code extension to aid developers in solving a range of software development problems.

Let's go step by step in understanding the architecture.

Agent

An Agent in the Sirji framework is a modular AI component that performs a specific task based on a custom pseudo code.

An agent defines its skills in an agent.yml file. This file lists the skills of the agent and the pseudo code to follow for each skill. It also specifies the LLM provider and model to be used for inference. Additionally, it lists the sub-agents that can be invoked from within the agent to complete certain parts of the task.

Example agent.yml file

id: NODE_JS_API_CODER
name: Node JS API Coder

llm:
  provider: openai
  model: gpt-4o

sub_agents:
    - id: CODE_PLANNER
    - id: CODE_WRITER

skills:
  - skill: "Developing robust backend REST APIs using Node.js and Express, integrating Sequelize ORM with PostgreSQL databases, and implementing Redis for efficient caching solutions."
    pseudo_code: |
      1. INVOKE_AGENT CODE_PLANNER to analyze problem statements, identify relevant files, thoroughly review their contents, identify relevant dependencies, thoroughly review their contents too, and create a detailed implementation guide.
      2. INVOKE_AGENT CODE_WRITER to read the implementation guide, extract necessary file changes, apply these modifications to the project files.
      3. Respond back to the agent who invoked you, detailing your actions in the BODY.

Recipe (recipe.json)

A Recipe is a file that lists prescribed tasks and tips for solving a particular problem. It also indicates which agent should perform each task. The tips provide guidance for addressing issues that arise when tasks are performed out of the prescribed order. Each tip specifies the task and the agent responsible for it.

Example Recipe File

{
  "prescribed_tasks": [
    {
      "task": "Write epics and user stories.",
      "agent": "PRODUCT_MANAGER"
    },
    {
      "task": "Write architecture components.",
      "agent": "ARCHITECT"
    },
    {
      "task": "Implement the epic & user stories using the architecture components.",
      "agent": "CODER"
    }
  ],
  "tips": [
    {
      "deviation": "Architecture components are not in sync with the epics and user stories.",
      "agent": "PRODUCT_MANAGER",
      "task": "Make the epics and user stories consistent with the architecture components."
    }
  ]
}

Recipe Index

The Recipe Index is a file that stores metadata about all the recipes in the Sirji framework. It contains details such as the description of each recipe and its file path.

[
  {
    "description": "Description of the recipe",
    "file": "Path to the recipe file"
  }
]

Agent Sessions

An Agent can be invoked in either a fresh session or asked to continue an existing session. When invoked in a new session, it starts with a new system prompt and does not retain the context from the previous session. Sessions help keep the context focused on specific tasks.

Orchestrator and User-Driven Configuration

The Orchestrator is the central component in the Sirji framework, responsible for managing the flow and execution of tasks across different agents. It coordinates the execution of tasks and ensures user-driven customization is integrated effectively.

Workflow

  • Problem Statement Analysis: The Orchestrator first asks the user for a problem statement. Depending on the requirements, such as a GitHub issue URL, it gathers necessary information by fetching issue content and cloning the repository. It then documents the detailed problem statement in the Shared Resources.
  • Recipe Selection and Customization: The Orchestrator selects the appropriate recipe for the session. If the user opts to reuse a previously loaded recipe and agents, it skips automatic recipe selection. Otherwise, it uses the Recipe Index and the problem statement to determine the most suitable recipe, storing the selected recipe.json file in the "active_recipe" folder. Additionally, it stores the agent.json files in the "active_recipe/agents" folder. This directory also contains a README file that explains various terminologies, provides descriptions of each file, and offers instructions on how to customize the recipes and agents, as well as guidance on publishing custom recipes and agents by making pull requests to the Sirji GitHub repository.
  • User Customization: Users can edit the files within the "active_recipe" folder to tailor the setup to their specific needs.
  • User Confirmation: Once the user finalizes their modifications in the "active_recipe" folder, they notify Sirji to proceed. Sirji then copies the whole "active_recipe" folder to the current session's folder to maintain a reference of the configurations used.
  • Configuration Preservation: The config.json file inside the "active_recipe" folder includes a retain_changes setting (defaults to false). If set to true, Sirji preserves these customizations and skips auto-selection in future sessions.
  • Task Execution and Management: The Orchestrator interprets the active recipe to identify and assign tasks to the appropriate agent. It also uses the "tips" in the recipe to handle deviations from the prescribed task order, ensuring smooth progression.

Project Folder

The Project Folder is the primary directory for accessing all user-specific project files, including code files, documentation, and other relevant resources. When initializing Sirji, the user selects this folder as the primary workspace for the project.

Agent Output Folder

The Agent Output Folder is designated for storing the results and data outputs generated by the agents. This folder is different from the project folder and this ensures that operational data is kept separate from project files.

Agent Output Index

The Agent Output Index is an index file for the Agent Output Folder that keeps track of all files written by agents in that folder along with the a brief description of the file contents.

Example Shared Resources index.json file

{
  "SIRJI/problem.txt": {
    "description": "Problem statement from the SIRJI_USER.",
    "created_by": "SIRJI"
  },
  "CODE_PLANNER/implementation_guide.md": {
    "description": "This file contains a detailed implementation guide for developing the ...",
    "created_by": "CODE_PLANNER"
  }
}
@kedarchandrayan kedarchandrayan added enhancement New feature or request documentation Improvements or additions to documentation and removed enhancement New feature or request labels Apr 19, 2024
@kedarchandrayan kedarchandrayan changed the title Agent Metadata and Recipe Orchestration Elaborate Agent Metadata and Recipe Orchestration Apr 20, 2024
@kedarchandrayan kedarchandrayan added the enhancement New feature or request label Apr 20, 2024
@kedarchandrayan kedarchandrayan changed the title Elaborate Agent Metadata and Recipe Orchestration Sirji AI Agentic Framework Architecture Documentation Apr 23, 2024
@kedarchandrayan kedarchandrayan self-assigned this Apr 25, 2024
@kedarchandrayan kedarchandrayan pinned this issue Apr 25, 2024
@kedarchandrayan kedarchandrayan added done and removed done labels Apr 29, 2024
@kedarchandrayan kedarchandrayan changed the title Sirji AI Agentic Framework Architecture Documentation Sirji AI Agentic Framework Architecture May 2, 2024
@kedarchandrayan kedarchandrayan changed the title Sirji AI Agentic Framework Architecture Sirji's Extendable AI Agentic Framework Architecture May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: Custom Agents & Recipes
Development

No branches or pull requests

1 participant