{"id":34039520,"url":"https://github.com/fetchai/ai-engine-sdk-python","last_synced_at":"2026-04-01T23:34:45.755Z","repository":{"id":243923973,"uuid":"811807471","full_name":"fetchai/ai-engine-sdk-python","owner":"fetchai","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-20T16:13:54.000Z","size":192,"stargazers_count":3,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-22T00:54:59.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fetchai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-07T10:44:44.000Z","updated_at":"2025-05-26T12:19:57.000Z","dependencies_parsed_at":"2024-10-24T16:55:09.103Z","dependency_job_id":"196dd112-4f4b-4ca7-aa8e-4705e820772c","html_url":"https://github.com/fetchai/ai-engine-sdk-python","commit_stats":null,"previous_names":["fetchai/ai-engine-sdk-python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fetchai/ai-engine-sdk-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchai%2Fai-engine-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchai%2Fai-engine-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchai%2Fai-engine-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchai%2Fai-engine-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fetchai","download_url":"https://codeload.github.com/fetchai/ai-engine-sdk-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchai%2Fai-engine-sdk-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"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":[],"created_at":"2025-12-13T21:41:26.986Z","updated_at":"2026-04-01T23:34:45.747Z","avatar_url":"https://github.com/fetchai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ⭐️ Features  \n  \n- Access to latest AI Engine features  \n  \n- Simple and intuitive API  \n  \n    \n  \n## 📦 Getting Started  \n  \n    \n```bash  \n  \npoetry add ai-engine-sdk  \n# or \npip install ai-engine-sdk  \n```  \n  \n    \n### Using the Chat API  \n  \nBefore you start to integrate the AI Engine into your app, you might want to get familiar with [agent functions](https://fetch.ai/docs/guides/agents/intermediate/agent-functions).  \n  \n    \n  \n#### Creating the AIEngine client object  \n  \nTo find out how to generate an \u003ccode\u003eapiKey\u003c/code\u003e check out the documentation regarding [Agentverse API keys](https://fetch.ai/docs/guides/apis/agent-function-creation-apis).  \n  \n```python  \nfrom ai_engine_sdk import AiEngine  \nai_engine: AiEngine = AiEngine(api_key)  \n  \n```  \n  \n    \n#### Querying the id of the function group where our to-be-used function(s) belong  \n  \n```python  \nfunction_groups: list[FunctionGroup] = await ai_engine.get_function_groups()  \n  \npublic_group = next(  \n    (g for g in function_groups if g.name == \"Fetch Verified\"), None  \n)  \n```  \n  \nIf you would like to use the functions in your own **My Functions** function group, you can use this filter instead:  \n  \n```python  \nmy_group = next(  \n    (g for g in function_groups if g.name == \"My Functions\"), None  \n)  \n```  \n  \n\n#### Sharing function groups\n##### **Purpose**: \nAllow to other users to use `functions`, under a concrete `function-group`, without replicating that `function` or allowing them alter those `functions`  or `funtion-group` data.\n\n##### How to:\nIf you wish to give access  to a certain `function-group`  (use, not alter the data/state of it), you can use the following method in the following way:\n\n```python\n# assuming `ai_engine` is a valid instance of AiEngine\n\nwhat_function_group_identifier_i_want_share=\"normally-this-is-an-uuid4\"\nuser_email_i_want_to_share_the_function_group_with = \"random@domain.com\"\nawait ai_engine.share_function_group(\n\tfunction_group_id=what_function_group_identifier_i_want_share,\n\ttarget_user_email=user_email_i_want_to_share_the_function_group_with\n)\n```\n\nNow, if you were requesting the available `function-groups` for the user with email assigned to the `target_user_email` argument, the `function-group` with the id assigned to `function_group_id`.\n\nYou can check that by using the `AiEngine.get_function_groups` method.\n#### Creating a session with the AI Engine using the \u003ccode\u003efunctionGroupId\u003c/code\u003e fetched before  \n  \n```python  \nsession = await ai_engine.create_session(function_group=public_group.uuid)  \n```  \n  \n    \n#### Starting the conversation with an arbitrary objective  \n  \n```python  \nawait session.start(objective)\n```  \n\n#### Querying new messages  \n  \nYou might want to query new messages regularly ...\n```python  \nwhile True:  \n    messages: list[ApiBaseMessage] = await session.get_messages()\n    # throttling\n    sleep(3)\n```  \n\n#### Execution a function on demand.\nThis is the first message that should be sent to the AI Engine for execution the function/s of your choice.  \nThe main difference in here it is the AI Engine won't search, therefore decide for you, what is the apt function to fulfill your needs.\n\nIt contains the list of function-ids you want to execute and a function group (for secondary function picks).\n\nCurrently only supported by Next Generation personality.\nDon't use this if you already sent 'start' message.\n\n```python\n# init the AI Engine client\nfrom ai_engine_sdk import AiEngine  \nai_engine: AiEngine = AiEngine(api_key)  \n# Create (do not start) a Session\nsession = await ai_engine.create_session(function_group=function_group.uuid)  \n\n# Execute function. You will receive no response.\nawait session.execute_function(function_ids=[function_uuid], objective=\"\", context=\"\")\n\n# In order to get some feedback, gather the messages as regular.\nwhile True:  \n    messages: list[ApiBaseMessage] = await session.get_messages()\n    # throttling\n    sleep(3)\n```\n#### Checking the type of the new message\n\nThere are 5 different types of messages which are generated by the AI Engine and the SDK implements methods for checking the type of the respective new \u003ccode\u003eMessage\u003c/code\u003e:\n\n* task selection message: \u003ccode\u003eis_task_selection_message\u003c/code\u003e - this message is generated for example in the case when the AI engine recommends functions based on the initial objective or in the case when the AI Engine finds multiple options to provide as an input for a function.\n\n* AI Engine message: \u003ccode\u003eis_ai_engine_message\u003c/code\u003e - this message type doesn't expect the user to reply to, this is for notifying the user about something\n\n* confirmation message: \u003ccode\u003eis_confirmation_message\u003c/code\u003e - when the AI Engine has managed to acquire all the inputs for the agent belonging to the to-be-executed function (= it has managed to build the context), it sends this type of message to the user\n\n* agent message: \u003ccode\u003eis_agent_message\u003c/code\u003e - this is a regular question that the user has to reply to with a string\n\n* stop message: \u003ccode\u003eis_stop_message\u003c/code\u003e - this is the message which is sent when the session has stopped and the AI Engine doesn't wait for any replies from the user\n\n  \n\n#### Replying to the different type of messages\n\nAll message types (except for the AI engine message and stop message) expect a response from the user and the SDK implements methods for sending reply in response to those different type of messages respectively.\n\nThe first argument of all these reply methods is the \u003ccode\u003eMessage\u003c/code\u003e object to which we want to send back the response.\n\nThe SDK methods you can use to reply to:\n\n* task selection message: \u003ccode\u003esession.submit_task_selection\u003c/code\u003e\n\n* agent message: \u003ccode\u003esession.submit_response\u003c/code\u003e\n\n* confirmation message: \u003ccode\u003esession.submit_confirmation\u003c/code\u003e or \u003ccode\u003esession.reject_confirmation\u003c/code\u003e - depending on if the user wants to confirm or reject the context generated by the AI engine respectively\n\n  \n\n#### Deleting session with AI engine\n\nAfter finishing the conversation with AI Engine you can delete the session like this:\n\n```python\n\nawait session.delete()\n\n```\n\n  \n    \nIf you would like to check out a complete example on how to integrate AI Engine into your app, feel free to checkout [examples/run_example.py](https://github.com/fetchai/ai-engine-sdk-python/blob/master/examples/run_example.py).  \n  \n   \n## 🔨 Useful scripts   \n### Create function groups and share them with other user\n#### Use cases:  \n- Test in different environments the function-group creation and sharing.\n### List function groups by user \nList the function belonging to the user owning the AV_API_TOKEN.\n#### Use cases:\n#### Share function group\nShare an existing function group by providing the id (you can fetch via ['list function groups'](#list-function-groups-by-user)\n## ✨ Contributing  \n  \n    \n  \nAll contributions are welcome! Remember, contribution includes not only code, but any help with docs or issues raised by other developers. See our [contribution guidelines](https://github.com/fetchai/ai-engine-sdk-js/blob/main/CONTRIBUTING.md) for more details.  \n  \n    \n  \n### ❓ Issues, Questions, and Discussions  \n  \n\nWe use [GitHub Issues](https://github.com/fetchai/ai-engine-sdk-python/issues) for tracking requests and bugs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetchai%2Fai-engine-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffetchai%2Fai-engine-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetchai%2Fai-engine-sdk-python/lists"}