{"id":43906250,"url":"https://github.com/eggai-tech/EggAI","last_synced_at":"2026-02-18T13:00:37.469Z","repository":{"id":267294915,"uuid":"899430590","full_name":"eggai-tech/EggAI","owner":"eggai-tech","description":"Async-first meta framework for building enterprise-grade multi-agent systems.","archived":false,"fork":false,"pushed_at":"2026-02-02T10:11:20.000Z","size":57975,"stargazers_count":51,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-08T13:22:16.651Z","etag":null,"topics":["ai-agents-framework","automation","generative-ai","llms","machine-learning","multi-agent-orchestration","multi-agent-systems","python"],"latest_commit_sha":null,"homepage":"https://docs.egg-ai.com/","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/eggai-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-06T08:53:18.000Z","updated_at":"2026-01-28T11:17:41.000Z","dependencies_parsed_at":"2025-01-02T12:21:31.219Z","dependency_job_id":"20b5d56a-b96d-45b5-ae32-7dae8b188d76","html_url":"https://github.com/eggai-tech/EggAI","commit_stats":null,"previous_names":["eggai-tech/eggai"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/eggai-tech/EggAI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggai-tech%2FEggAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggai-tech%2FEggAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggai-tech%2FEggAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggai-tech%2FEggAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggai-tech","download_url":"https://codeload.github.com/eggai-tech/EggAI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggai-tech%2FEggAI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29580622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"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":["ai-agents-framework","automation","generative-ai","llms","machine-learning","multi-agent-orchestration","multi-agent-systems","python"],"created_at":"2026-02-06T20:00:20.121Z","updated_at":"2026-02-18T13:00:37.462Z","avatar_url":"https://github.com/eggai-tech.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/eggai-word-and-figuremark.svg\" alt=\"EggAI word and figuremark\" width=\"200px\" style=\"margin-bottom: 16px;\" /\u003e\n\n# Multi-Agent Meta Framework\n\nDocumentation: [EggAI Docs](https://docs.egg-ai.com/)\n\n\u003c!--start--\u003e\n\n[![Python 3.x](https://img.shields.io/badge/python-3.x-blue?style=for-the-badge\u0026logo=python\u0026logoColor=white)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green?style=for-the-badge\u0026logo=opensourceinitiative\u0026logoColor=white)](https://opensource.org/licenses/MIT)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=for-the-badge\u0026logo=github\u0026logoColor=white)](https://github.com/eggai-tech/eggai/pulls)\n[![GitHub Issues](https://img.shields.io/github/issues/eggai-tech/eggai?style=for-the-badge\u0026logo=github\u0026logoColor=white)](https://github.com/eggai-tech/eggai/issues)\n[![GitHub Stars](https://img.shields.io/github/stars/eggai-tech/eggai?style=for-the-badge\u0026logo=github\u0026logoColor=white)](https://github.com/eggai-tech/eggai/stargazers)\n\n`EggAI Multi-Agent Meta Framework` makes it easy to build enterprise-grade multi-agent systems with quality-controlled output, using an async-first, distributed and composable architecture.\nThe framework includes:\n- \u003ca href=\"sdk/\"\u003eEggAI SDK\u003c/a\u003e:  A lightweight abstraction layer for building agents and enabling agent-to-agent communication.\n- \u003ca href=\"https://github.com/eggai-tech/eggai-examples\"\u003eExamples\u003c/a\u003e: Practical use cases showing how to use the SDK and integrate EggAI with leading AI frameworks.\n- \u003ca href=\"https://github.com/eggai-tech/eggai-demo\"\u003eDemo\u003c/a\u003e: A working multi-agent insurance support system showcasing the Meta Framework in action.\n\n\u003cp\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/eggai-meta-framework-arch.png\" alt=\"EggAI Meta Framework Architecture\" width=\"100%\"\u003e\n  \u003cbr\u003e\n  \u003cem\u003eEggAI Meta Framework design principles: framework-agnostic, async-first, distributed and composable\u003c/em\u003e\n\u003c/p\u003e\n\n\n## Demo: Multi-Agent Insurance Support System\n\nThe EggAI Meta Framework powers a [multi-agent insurance support system demo](https://github.com/eggai-tech/eggai-demo).\nThis interactive demo showcases how EggAI can orchestrate multiple specialized agents to provide\npersonalized insurance support. It features billing inquiries, claims processing, policy information retrieval (RAG), and intelligent routing.\n\n![Multi-Agent Insurance Support System Demo Screenshot](https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/support-chat.png)\n\n\n## Examples: AI Enablement in Action\n\nEggAI's SDK is intentionally **simple**, **lightweight**, and **framework-agnostic**, making it easy to integrate with today's leading AI tools—and future-ready for what's next.\nHere we show practical implementation scenarios and integration guides with popular AI frameworks.\nEach example is self-contained and ready to run out of the box.\nWe encourage you to explore and **copy/paste** from our examples for your projects.\n\nIf you're new to EggAI, we recommend starting with the [Getting Started](https://github.com/eggai-tech/eggai-examples/tree/main/getting_started) example to learn the basics of agent definition, communication flows and async orchestration.\n\n\u003ctable style=\"width: 100%;\"\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd style=\"width: 15%;\"\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/getting_started\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-00.png\" alt=\"Getting Started\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/getting_started\"\u003e\u003cstrong\u003eGetting Started\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Orchestrate two agents asynchronously.\u003cbr/\u003e\n        \u003csmall\u003eTags: Communication\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/coordinator\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-01.png\" alt=\"Coordinator\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/coordinator\"\u003e\u003cstrong\u003eCoordinator\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Bridge multiple communication channels.\u003cbr/\u003e\n        \u003csmall\u003eTags: Communication, Pattern\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/websocket_gateway\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-02.png\" alt=\"Websocket Gateway\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/websocket_gateway\"\u003e\u003cstrong\u003eWebsocket Gateway\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Real-time interaction via WebSockets.\u003cbr/\u003e\n        \u003csmall\u003eTags: Communication, Realtime\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/dspy_react\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/react-agent-dspy.png\" alt=\"DSPy ReAct\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/dspy_react\"\u003e\u003cstrong\u003eDSPy ReAct Agent\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Advanced Agents with DSPy ReAct.\u003cbr/\u003e\n        \u003csmall\u003eTags: DSPy, Tool Calling, React\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/langchain_tool_calling\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-03.png\" alt=\"LangChain Tool Calling\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/langchain_tool_calling\"\u003e\u003cstrong\u003eLangChain Agent\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Integrate tool calling with LangChain.\u003cbr/\u003e\n        \u003csmall\u003eTags: Tool Calling, LangChain\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/litellm_agent\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-05.png\" alt=\"LiteLLM Agent\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/litellm_agent\"\u003e\u003cstrong\u003eLiteLLM Agent\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Power agents with LiteLLM.\u003cbr/\u003e\n        \u003csmall\u003eTags: LiteLLM\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/agent_evaluation_dspy\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/agent-evaluation-dspy.png\" alt=\"Agent Evaluation \u0026 DSPy\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/agent_evaluation_dspy\"\u003e\u003cstrong\u003eAgent Evaluation \u0026 Optimization with DSPy\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Data-driven development with DSPy.\u003cbr/\u003e\n        \u003csmall\u003eTags: DSPy, Evaluation, Optimization\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/safe_agents_guardrails\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/safe-agents-guardrails.png\" alt=\"Safe Agents with Guardrails AI\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/safe_agents_guardrails\"\u003e\u003cstrong\u003eSafe Agents with Guardrails AI\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Guarding LLM agents against toxicity and PII leakage.\u003cbr/\u003e\n        \u003csmall\u003eTags: DSPy, Guardrails\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/triage_agent\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/triage-agent.png\" alt=\"Triage Agent\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/triage_agent\"\u003e\u003cstrong\u003eTriage Agent\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Triage Agent with classification and routing.\u003cbr/\u003e\n        \u003csmall\u003eTags: Classification, Routing\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/shared_context\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-04.png\" alt=\"Shared Context\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/shared_context\"\u003e\u003cstrong\u003eShared Context\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Maintain shared context across agents.\u003cbr/\u003e\n        \u003csmall\u003eTags: Communication, Memory\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/multi_agent_conversation\"\u003e\n          \u003cimg src=\"https://raw.githubusercontent.com/eggai-tech/EggAI/refs/heads/main/docs/docs/assets/example-06.png\" alt=\"Multi-Agent Conversation\" width=\"80\"/\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://github.com/eggai-tech/eggai-examples/tree/main/multi_agent_conversation\"\u003e\u003cstrong\u003eMulti-Agent Conversation\u003c/strong\u003e\u003c/a\u003e\u003cbr/\u003e\n        Context-aware multi-agent conversations.\u003cbr/\u003e\n        \u003csmall\u003eTags: Communication, Classification, Routing, Chat\u003c/small\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## EggAI SDK\n\n**EggAI SDK** includes components like `Agent` and `Channel` for decoupled communication in multi-agent systems. Its slim design offers flexibility for enterprise-grade applications and seamless integration with popular AI frameworks such as [DSPy](https://dspy.ai/), [LangChain](https://www.langchain.com/), and [LlamaIndex](https://www.llamaindex.ai/), see examples below:\n\n#### AI Framework Integrations\n\n\u003cdetails\u003e\n\u003csummary\u003eDSPy Agent\u003c/summary\u003e\n\n```python\n# Install `eggai` and `dspy` and set OPENAI_API_KEY in the environment\n\nimport asyncio\nimport dspy\nfrom eggai import Agent, Channel, eggai_main\n\ndspy.configure(lm=dspy.LM(\"openai/gpt-4o-mini\"))\nqa_model = dspy.Predict(\"question -\u003e answer\")\nagent, channel = Agent(\"QAAgent\"), Channel()\n\n@agent.subscribe(filter_by_message=lambda event: event.get(\"event_name\") == \"question_created\")\nasync def handle_question(event):\n    question = event[\"payload\"][\"question\"]\n    answer = qa_model(question=question).answer\n    print(f\"[QAAgent] Question: {question} | Answer: {answer}\")\n\n    await channel.publish({\n        \"event_name\": \"answer_generated\",\n        \"payload\": {\"question\": question, \"answer\": answer}\n    })\n\n@eggai_main\nasync def main():\n    await agent.start()\n    await channel.publish({\n        \"event_name\": \"question_created\",\n        \"payload\": {\"question\": \"When was the Eiffel Tower built?\"}\n    })\n    await asyncio.Future()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eLangChain Agent\u003c/summary\u003e\n\n```python\n# Install `eggai` and `langchain` and set OPENAI_API_KEY in the environment\n\nimport asyncio\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.schema import HumanMessage\nfrom eggai import Agent, Channel, eggai_main\n\nllm = ChatOpenAI(model_name=\"gpt-4o\", temperature=0)\nagent, channel = Agent(\"QAAgent\"), Channel()\n\n@agent.subscribe(filter_by_message=lambda event: event.get(\"event_name\") == \"question_created\")\nasync def handle_question(event):\n    question = event[\"payload\"][\"question\"]\n    answer = llm([HumanMessage(content=question)]).content\n\n    print(f\"[QAAgent] Question: {question} | Answer: {answer}\")\n\n    await channel.publish({\n        \"event_name\": \"answer_generated\",\n        \"payload\": {\"question\": question, \"answer\": answer}\n    })\n\n@eggai_main\nasync def main():\n    await agent.start()\n    await channel.publish({\n        \"event_name\": \"question_created\",\n        \"payload\": {\"question\": \"When was the Eiffel Tower built?\"}\n    })\n    await asyncio.Future()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eLiteLLM Agent\u003c/summary\u003e\n\n```python\n# Install `eggai` and `litellm` and set OPENAI_API_KEY in the environment\n\nimport asyncio\nimport litellm\nfrom eggai import Agent, Channel, eggai_main\n\nlitellm.model = \"gpt-4o\"\nagent, channel = Agent(\"QAAgent\"), Channel()\n\n@agent.subscribe(filter_by_message=lambda event: event.get(\"event_name\") == \"question_created\")\nasync def handle_question(event):\n    question = event[\"payload\"][\"question\"]\n    answer = litellm.completion(model=litellm.model, messages=[{\"role\": \"user\", \"content\": question}])[\"choices\"][0][\"message\"][\"content\"]\n\n    print(f\"[QAAgent] Question: {question} | Answer: {answer}\")\n\n    await channel.publish({\n        \"event_name\": \"answer_generated\",\n        \"payload\": {\"question\": question, \"answer\": answer}\n    })\n\n@eggai_main\nasync def main():\n    await agent.start()\n    await channel.publish({\n        \"event_name\": \"question_created\",\n        \"payload\": {\"question\": \"When was the Eiffel Tower built?\"}\n    })\n    await asyncio.Future()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eLlamaIndex Agent\u003c/summary\u003e\n\n```python\n# Install `eggai` and `llama_index` and set OPENAI_API_KEY in the environment\n\nimport asyncio\nfrom llama_index.llms.openai import OpenAI\nfrom eggai import Agent, Channel, eggai_main\n\nllm = OpenAI(model=\"gpt-4o\")\nagent, channel = Agent(\"QAAgent\"), Channel()\n\n@agent.subscribe(filter_by_message=lambda event: event.get(\"event_name\") == \"question_created\")\nasync def handle_question(event):\n    question = event[\"payload\"][\"question\"]\n    answer = llm.complete(question).text\n\n    print(f\"[QAAgent] Question: {question} | Answer: {answer}\")\n\n    await channel.publish({\n        \"event_name\": \"answer_generated\",\n        \"payload\": {\"question\": question, \"answer\": answer}\n    })\n\n@eggai_main\nasync def main():\n    await agent.start()\n    await channel.publish({\n        \"event_name\": \"question_created\",\n        \"payload\": {\"question\": \"When was the Eiffel Tower built?\"}\n    })\n    await asyncio.Future()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n\u003c/details\u003e\n\n#### AI Agent Evaluations\n\n\u003cdetails\u003e\n\u003csummary\u003eAgent Evaluation using LLM-as-a-Judge metrics\u003c/summary\u003e\n\n```python\n# Install `eggai` and `dspy` and set OPENAI_API_KEY in the environment\n# Make sure to have the agent implementation in the `agent.py` file defined\n\nimport asyncio\nimport pytest\nimport dspy\nfrom agent import agent\nfrom eggai import Agent, Channel\n\ndspy.configure(lm=dspy.LM(\"openai/gpt-4o-mini\"))\n\nground_truth = [\n    {\"question\": \"When was the Eiffel Tower built?\", \"answer\": \"The Eiffel Tower was built between 1887 and 1889.\"},\n    {\"question\": \"Who wrote Hamlet?\", \"answer\": \"Hamlet was written by William Shakespeare.\"},\n    {\"question\": \"What is the capital of France?\", \"answer\": \"The capital of France is Paris.\"},\n]\n\nclass EvaluationSignature(dspy.Signature):\n    question: str = dspy.InputField(desc=\"Ground truth question.\")\n    agent_answer: str = dspy.InputField(desc=\"Agent-generated answer.\")\n    ground_truth_answer: str = dspy.InputField(desc=\"Expected correct answer.\")\n\n    judgment: bool = dspy.OutputField(desc=\"Pass (True) or Fail (False).\")\n    reasoning: str = dspy.OutputField(desc=\"Detailed justification in Markdown.\")\n    precision_score: float = dspy.OutputField(desc=\"Precision score (0.0 to 1.0).\")\n\ntest_agent = Agent(\"TestAgent\")\ntest_channel = Channel()\nevent_received = asyncio.Event()\nreceived_event = None\n\n@test_agent.subscribe(filter_by_message=lambda event: event.get(\"event_name\") == \"answer_generated\")\nasync def handle_answer(event):\n    global received_event\n    received_event = event\n    event_received.set()\n\n@pytest.mark.asyncio\nasync def test_qa_agent():\n    await agent.start()\n    await test_agent.start()\n\n    for item in ground_truth:\n        event_received.clear()\n\n        await test_channel.publish({\"event_name\": \"question_created\", \"payload\": {\"question\": item[\"question\"]}})\n\n        try:\n            await asyncio.wait_for(event_received.wait(), timeout=5.0)\n        except asyncio.TimeoutError:\n            pytest.fail(f\"Timeout: No 'answer_generated' event was published for question: {item['question']}\")\n\n        assert received_event is not None, \"No 'answer_generated' event was received.\"\n        assert received_event[\"event_name\"] == \"answer_generated\", \"Unexpected event type received.\"\n        assert \"answer\" in received_event[\"payload\"], \"The 'answer' key is missing in the payload.\"\n\n        agent_answer = received_event[\"payload\"][\"answer\"]\n        question = received_event[\"payload\"][\"question\"]\n        ground_truth_answer = item[\"answer\"]\n\n        assert question == item[\"question\"], f\"Incorrect question in the answer payload: {question}\"\n\n        eval_model = dspy.asyncify(dspy.Predict(EvaluationSignature))\n        evaluation_result = await eval_model(\n            question=question,\n            agent_answer=agent_answer,\n            ground_truth_answer=ground_truth_answer\n        )\n\n        assert evaluation_result.judgment, \"Judgment must be True. \" + evaluation_result.reasoning\n        assert 0.8 \u003c= evaluation_result.precision_score \u003c= 1.0, \"Precision score must be between 0.8 and 1.0.\"\n```\n\n\u003c/details\u003e\n\n### Installation\n\nInstall `eggai` via pip:\n\n```bash\npip install eggai\n```\n\nFor local development, clone the repository and install the package in editable mode:\n\n```bash\npip install -e .\n```\n\n### Getting Started\n\nFor a quick start with a structured project, use the EggAI CLI to generate a new multi-agent application:\n\n```bash\npipx run eggai[cli] init\n```\n\nThis will create a complete project with agents, console interface, and configuration files.\n\nAlternatively, here's how you can quickly set up an agent to handle events in an event-driven system:\n\n```python\nimport asyncio\n\nfrom eggai import Agent, Channel, eggai_main\n\nagent = Agent(\"OrderAgent\")\nchannel = Channel()\n\n@agent.subscribe(filter_by_message=lambda e: e.get(\"type\") == \"order_requested\")\nasync def handle_order_requested(event):\n    print(f\"[ORDER AGENT]: Received order request. Event: {event}\")\n    await channel.publish({\"type\": \"order_created\", \"payload\": event})\n\n\n@agent.subscribe(filter_by_message=lambda e: e.get(\"type\") == \"order_created\")\nasync def handle_order_created(event):\n    print(f\"[ORDER AGENT]: Order created. Event: {event}\")\n\n\n@eggai_main\nasync def main():\n    await agent.start()\n    await channel.publish({\n        \"type\": \"order_requested\",\n        \"payload\": {\n            \"product\": \"Laptop\",\n            \"quantity\": 1\n        }\n    })\n\n    await asyncio.Future()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\nCopy this snippet into your project, customize it, and you're good to go!\n\n### Core Concepts\n\nAn `Agent` is an autonomous unit of business logic designed to orchestrate workflows, process events, and communicate with external systems such as Large Language Models (LLMs) and APIs. It reduces boilerplate code while supporting complex and long-running workflows. Key features include:\n\n- **Event Handling**: Use the `subscribe` decorator to bind user-defined handlers to specific events.\n- **Workflow Orchestration**: Manage long-running workflows and tasks efficiently.\n- **External System Communication**: Seamlessly interact with Large Language Models (LLMs), external APIs, and other systems.\n- **Lifecycle Management**: Automatically handle the lifecycle of Kafka consumers, producers, and other connected components.\n- **Boilerplate Reduction**: Focus on core business logic while leveraging built-in integrations for messaging and workflows.\n\nA `Channel` is the foundational communication layer that facilitates both event publishing and subscription.\nIt abstracts Kafka producers and consumers, enabling efficient and flexible event-driven operations. Key features include:\n\n- **Event Communication**: Publish events to Kafka topics with ease.\n- **Event Subscription**: Subscribe to Kafka topics and process events directly through the `Channel`.\n- **Shared Resources**: Optimize resource usage by managing singleton Kafka producers and consumers across multiple agents or channels.\n- **Seamless Integration**: Act as a communication hub, supporting both Agents and other system components.\n- **Flexibility**: Allow Agents to leverage Channels for both publishing and subscribing, reducing complexity and duplication.\n\n### **Interoperability**\n\nIn enterprise environments, diverse programming languages and frameworks create fragmentation. EggAI Agents serve as thin, flexible connectors, enabling seamless integration within the multi-agent system. This ensures enterprises can continuously enhance their AI capabilities without the need for costly re-platforming.\n\nIf you use the Kafka transport, you can directly integrate using Kafka libraries available for various programming languages:\n\n- [Python: `confluent-kafka`](https://github.com/confluentinc/confluent-kafka-python)\n- [JavaScript / TypeScript: `kafkajs`](https://github.com/tulios/kafkajs)\n- [Java / Kotlin: `kafka-clients`](https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients)\n- [Go: `sarama`](https://github.com/Shopify/sarama)\n- [C#: `Confluent.Kafka`](https://github.com/confluentinc/confluent-kafka-dotnet)\n- [Rust: `rdkafka`](https://github.com/fede1024/rust-rdkafka)\n\nFor structured communication within the multi-agent system, we recommend using the EggAI Message Base Schema, which defines a standardized message format for consistency and interoperability.\n\n\u003cdetails\u003e\n  \u003csummary\u003eView EggAI Message Base Schema\u003c/summary\u003e\n\n```json\n{\n  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n  \"title\": \"MessageBase\",\n  \"description\": \"Base class for all messages in the communication protocol.\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"id\": {\n      \"type\": \"string\",\n      \"format\": \"uuid\",\n      \"description\": \"Unique identifier for correlating requests and responses.\"\n    },\n    \"type\": {\n      \"type\": \"string\",\n      \"description\": \"Type of the message (e.g., request, response, event).\"\n    },\n    \"metadata\": {\n      \"type\": \"object\",\n      \"additionalProperties\": true,\n      \"description\": \"Additional metadata for the message.\"\n    },\n    \"context\": {\n      \"type\": \"object\",\n      \"additionalProperties\": true,\n      \"description\": \"Contextual information for the message.\"\n    },\n    \"payload\": {\n      \"type\": \"object\",\n      \"additionalProperties\": true,\n      \"description\": \"Message-specific data.\"\n    }\n  },\n  \"required\": [\"id\", \"type\"]\n}\n```\n\n\u003c/details\u003e\n\n### Why Copy/Paste?\n\n**1. Full Ownership and Control**\nBy copying and pasting, you have direct access to the underlying implementation. Tweak or rewrite as you see fit, the code is truly yours.\n\n**2. Separation of Concerns**\nJust like decoupling design from implementation, copying code (rather than installing a monolithic dependency) reduces friction if you want to restyle or refactor how agents are structured.\n\n**3. Flexibility**\nNot everyone wants a one-size-fits-all library. With copy/paste \"recipes,\" you can integrate only the parts you need.\n\n**4. No Hidden Coupling**\nSometimes, prepackaged frameworks lock in design decisions. By copying from examples, you choose exactly what gets included and how it's used.\n\n\u003c!--end--\u003e\n\n## Contribution\n\n`EggAI Multi-Agent Meta Framework` is open-source and we welcome contributions. If you're looking to contribute, please refer to [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggai-tech%2FEggAI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggai-tech%2FEggAI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggai-tech%2FEggAI/lists"}