{"id":28193243,"url":"https://github.com/mjunaidca/create-daca","last_synced_at":"2026-04-28T18:04:23.825Z","repository":{"id":287125448,"uuid":"963680528","full_name":"mjunaidca/create-daca","owner":"mjunaidca","description":"Template for agentic Chat \u0026 Memory Agents with Dapr runtime, UV simplicity, and OpenAI Agents SDK.","archived":false,"fork":false,"pushed_at":"2025-04-10T03:55:54.000Z","size":62,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-16T12:17:15.593Z","etag":null,"topics":["agent","agentic-systems","ai-template","chat-agent","cloud-agent","dapr","dapr-pub-sub","deploy-age","distributed-systems","fastapi","fastapi-template","memory-agent","openai-agent-sdk","openai-agents"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjunaidca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-10T03:50:10.000Z","updated_at":"2025-05-05T05:40:34.000Z","dependencies_parsed_at":"2025-04-10T04:48:59.698Z","dependency_job_id":null,"html_url":"https://github.com/mjunaidca/create-daca","commit_stats":null,"previous_names":["mjunaidca/create-daca"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mjunaidca/create-daca","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Fcreate-daca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Fcreate-daca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Fcreate-daca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Fcreate-daca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjunaidca","download_url":"https://codeload.github.com/mjunaidca/create-daca/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Fcreate-daca/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32392315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","agentic-systems","ai-template","chat-agent","cloud-agent","dapr","dapr-pub-sub","deploy-age","distributed-systems","fastapi","fastapi-template","memory-agent","openai-agent-sdk","openai-agents"],"created_at":"2025-05-16T12:17:15.231Z","updated_at":"2026-04-28T18:04:23.810Z","avatar_url":"https://github.com/mjunaidca.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Create Daca\n\n**Template with Prebuilt Chat Agent, Memory Agent built using OpenAI Agents SDK, Event-Driven Communication, Distributed Runtime, and Simplicity at its core.**\n\n\u003e **Note**: \u003cspan style=\"color: orange;\"\u003eThis is an educational and experimental template designed to explore agentic systems with Dapr, UV, and an agent engine like OpenAI Agents SDK. Use it to learn and experiment!\u003c/span\u003e\n\n\u003cp\u003e A UV-based template for **developing and deploying agentic systems**—autonomous, AI-driven agents powered by a **distributed runtime foundation** with Dapr. Featuring a **Chat Agent** and a **Memory Agent**, built with the OpenAI Agents SDK, this package offers a simple, flexible base for agent-driven projects. It works with any agent engine (e.g., LangGraph, CrewAI, Dapr Agents, or pure Python) and scales from local tinkering to cloud deployment. Dive into the code below to see how it works! \u003c/p\u003e\n---\n\n## Quick Start \n\n1. **Install**:\n```bash\n   uvx create-daca my-new-project\n   cd my-new-project\n```\n2. Run (after setting GEMINI_API_KEY in .env files—see below):\n```bash\ndapr init\ncd agent_memory_service \u0026\u0026 uv sync \u0026\u0026 uv add openai-agents \u0026\u0026 dapr run --app-id agent-memory-service --app-port 8001 --dapr-http-port 3501 --resources-path ../components -- uv run uvicorn main:app --reload \u0026\ncd chat_service \u0026\u0026 uv sync \u0026\u0026 dapr run --app-id chat-service --app-port 8010 --dapr-http-port 3500 --resources-path ../components -- uv run uvicorn main:app --reload\n```\n3. Chat\nOpen locahost:8010/docs and localhost:8001/docs or in terminal\n   - Initialize memory:\n     ```bash\n     curl -X POST http://localhost:8001/memories/junaid/initialize -H \"Content-Type: application/json\" -d '{\"name\": \"Junaid\", \"preferred_style\": \"formal\", \"user_summary\": \"Junaid is a new user.\"}'\n     ```\n   - Chat:\n     ```bash\n     curl -X POST http://localhost:8010/chat/ -H \"Content-Type: application/json\" -d '{\"user_id\": \"junaid\", \"text\": \"Hello\"}'\n     ```\n\n## What It Offers\n- **Chat Agent**: Handles user interactions with LLM-powered responses, publishing events for collaboration.\n- **Memory Agent**: Persists and enriches agent memory with dynamic LLM insights.\n- **Distributed Runtime**: Dapr ensures resilience and scalability via Pub/Sub and state management.\n- **Development Ready**: Build and test agents locally with UV.\n- **Deployable**: Scale to distributed systems with Dapr’s runtime.\n- **Flexible**: Swap in any agent engine for custom workflows.\n\nDerived from [Step 7 of the Panaversity **Dapr Agentic Cloud Ascent (DACA)** series](https://github.com/panaversity/learn-agentic-ai/tree/main/01_openai_agents/17_daca_local_dev), this is your foundation for agentic innovation.\n\n---\n\n## How to Use It\n1. **Install**:\n   ```bash\n   uvx create-daca my-new-project\n   cd my-new-project\n   ```\n\n2. **Set Up Environment**:\n   ```bash\n   echo \"GEMINI_API_KEY=your-api-key\" \u003e chat_service/.env\n   echo \"GEMINI_API_KEY=your-api-key\" \u003e agent_memory_service/.env\n   ```\n\n3. **Run Locally**:\n   - Initialize Dapr (`dapr init`) and ensure Redis is at `localhost:6379`.\n   - Memory Agent:\n     ```bash\n     cd agent_memory_service\n     uv venv\n     source .venv/bin/activate\n     uv sync\n     dapr run --app-id agent-memory-service --app-port 8001 --dapr-http-port 3501 --resources-path ../components -- uv run uvicorn main:app --host 0.0.0.0 --port 8001 --reload\n     ```\n   - Chat Agent (new terminal):\n     ```bash\n     cd chat_service\n     uv venv\n     source .venv/bin/activate\n     uv sync\n     dapr run --app-id chat-service --app-port 8010 --dapr-http-port 3500 --resources-path ../components -- uv run uvicorn main:app --host 0.0.0.0 --port 8010 --reload\n     ```\n\n4. **Test**:\n   - Initialize memory:\n     ```bash\n     curl -X POST http://localhost:8001/memories/junaid/initialize -H \"Content-Type: application/json\" -d '{\"name\": \"Junaid\", \"preferred_style\": \"formal\", \"user_summary\": \"Junaid is a new user.\"}'\n     ```\n   - Chat:\n     ```bash\n     curl -X POST http://localhost:8010/chat/ -H \"Content-Type: application/json\" -d '{\"user_id\": \"junaid\", \"text\": \"Hello\"}'\n     ```\n\n5. **Try Swagger Docs**\nIn browser open\n- Chat Agent: http://localhost:8010\n- Memory Agent: http://localhost:80001\n\n6. **Deploy**: Update Dapr components (e.g., use a cloud broker) and deploy to your environment.\n\n---\n\n## Core Breakdown \u0026 Code Explanation\nThis template includes two agents and Dapr components, with code designed for agentic collaboration:\n\n### Chat Agent (`chat_service/`)\n- **Role**: Engages users, publishes events to coordinate with the Memory Agent.\n- **Key Code** (`main.py`):\n  ```python\n  async def publish_conversation_event(user_id: str, session_id: str, user_text: str, reply_text: str, dapr_port: int = 3500):\n      dapr_url = f\"http://localhost:{dapr_port}/v1.0/publish/pubsub/conversations\"\n      event_data = {\n          \"user_id\": user_id, \"session_id\": session_id, \"event_type\": \"ConversationUpdated\",\n          \"user_message\": user_text, \"assistant_reply\": reply_text\n      }\n      async with httpx.AsyncClient() as client:\n          response = await client.post(dapr_url, json=event_data)\n          response.raise_for_status()\n\n  @app.post(\"/chat/\", response_model=Response)\n  async def chat(message: Message):\n      chat_agent = Agent(name=\"ChatAgent\", instructions=\"...\", tools=[get_current_time], model=model)\n      result = await Runner.run(chat_agent, input=message.text, run_config=config)\n      await publish_conversation_event(message.user_id, session_id, message.text, result.final_output)\n      return Response(user_id=message.user_id, reply=result.final_output, metadata=Metadata(session_id=session_id))\n  ```\n  - **What It Does**: Uses OpenAI Agents SDK to process input, publishes “ConversationUpdated” events via Dapr Pub/Sub for asynchronous coordination.\n\n- **Models** (`models.py`):\n  ```python\n  class Message(BaseModel):\n      user_id: str\n      text: str\n      metadata: Metadata | None = None\n  class Response(BaseModel):\n      user_id: str\n      reply: str\n      metadata: Metadata\n  ```\n  - **Purpose**: Defines data structures for chat input/output.\n\n- **Tests** (`test_main.py`): Includes `pytest` mocks to verify event publishing and responses.\n\n### Memory Agent (`agent_memory_service/`)\n- **Role**: Listens to events, updates history, and generates dynamic metadata.\n- **Key Code** (`main.py`):\n  ```python\n  async def generate_user_summary(user_id: str, history: list[dict]) -\u003e str:\n      summary_agent = Agent(name=\"SummaryAgent\", instructions=\"Generate a concise summary...\", model=model)\n      history_text = \"\\n\".join([f\"{entry['role']}: {entry['content']}\" for entry in history[-5:]])\n      result = await Runner.run(summary_agent, input=history_text, run_config=config)\n      return result.final_output\n\n  @app.post(\"/conversations\")\n  async def handle_conversation_updated(event: dict):\n      event_data = event.get(\"data\", {})\n      if event_data.get(\"event_type\") == \"ConversationUpdated\":\n          history = await get_conversation_history(event_data[\"session_id\"])\n          history.extend([{\"role\": \"user\", \"content\": event_data[\"user_message\"]}, {\"role\": \"assistant\", \"content\": event_data[\"assistant_reply\"]}])\n          await set_conversation_history(event_data[\"session_id\"], history)\n          metadata = await get_user_metadata(event_data[\"user_id\"])\n          metadata[\"user_summary\"] = await generate_user_summary(event_data[\"user_id\"], history)\n          await set_user_metadata(event_data[\"user_id\"], metadata)\n      return {\"status\": \"SUCCESS\"}\n  ```\n  - **What It Does**: Subscribes to `conversations` topic, updates state in Dapr’s store, and uses an LLM to enrich metadata.\n\n- **Models** (`models.py`):\n  ```python\n  class UserMetadata(BaseModel):\n      name: str\n      preferred_style: str\n      user_summary: str\n  ```\n  - **Purpose**: Structures memory data for persistence and retrieval.\n\n- **Tests** (`test_main.py`): Verifies event handling, state updates, and summary generation.\n\n### Dapr Components (`components/`)\n- **Files**:\n  - `pubsub.yaml`: Configures Redis Pub/Sub for event-driven communication.\n    ```yaml\n    apiVersion: dapr.io/v1alpha1\n    kind: Component\n    metadata:\n      name: pubsub\n    spec:\n      type: pubsub.redis\n      version: v1\n      metadata:\n      - name: redisHost\n        value: localhost:6379\n    ```\n  - `statestore.yaml`: Configures Redis state store for persistent memory.\n    ```yaml\n    apiVersion: dapr.io/v1alpha1\n    kind: Component\n    metadata:\n      name: statestore\n    spec:\n      type: state.redis\n      version: v1\n      metadata:\n      - name: redisHost\n        value: localhost:6379\n    ```\n  - `subscriptions.yaml`: Routes `conversations` topic to `/conversations` endpoint.\n    ```yaml\n    apiVersion: dapr.io/v1alpha1\n    kind: Subscription\n    metadata:\n      name: conversation-subscription\n    spec:\n      pubsubname: pubsub\n      topic: conversations\n      route: /conversations\n    ```\n- **Purpose**: Provides the distributed runtime foundation for agent collaboration and state management.\n\n---\n\n## Why It’s an Agent-Serving Template\n- **Develop + Deploy**: Code supports local development and distributed deployment with Dapr.\n- **Distributed Runtime**: Dapr’s Pub/Sub and state management ensure agent resilience and scalability.\n- **Agentic Design**: Chat and Memory Agents collaborate autonomously via events.\n- **Flexible Engine**: Built with OpenAI Agents SDK, adaptable to LangGraph, CrewAI, or custom Python.\n- **Cloud Foundation**: Ready for scaling agentic systems in distributed environments.\n- **Educational**: Learn agentic principles through practical, deployable code.\n\n---\n\n## For Learning More\nExplore the **Dapr Agentic Cloud Ascent (DACA)** series for a deeper dive:\n- [DACA Series](https://github.com/panaversity/learn-agentic-ai/tree/main/01_openai_agents/17_daca_local_dev)\n\n---\n\n## Requirements\n- Dapr CLI v1.15+ (`dapr init`)\n- Docker (Redis)\n- Python 3.12+ (3.13 compatible)\n- UV\n- Gemini API Key\n\n---\n\n## Why Use This?\n- **Agent-First**: Ready-made agents for development and deployment.\n- **Distributed**: Dapr runtime for scalability and resilience.\n- **Flexible**: Any agent engine, any environment.\n- **Learn**: Explore agentic systems hands-on.\n\nStart your agentic journey with `uvx create-daca`!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjunaidca%2Fcreate-daca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjunaidca%2Fcreate-daca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjunaidca%2Fcreate-daca/lists"}