Skip to content

Commit 50e5136

Browse files
committed
feat: ai hub
1 parent 79dba28 commit 50e5136

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

docs/environments/08-ai-hub.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_position: 8
3+
description: Nevermined AI Hub
4+
---
5+
6+
# Nevermined AI Hub
7+
8+
## Introduction
9+
10+
The Nevermined AI Hub (aka AI Hub or Hub) is a set of infrastructure and AI services provided by
11+
Nevermined with the intention of making simpler the delivery of AI Agents and services for
12+
developers.
13+
14+
## Benefits
15+
16+
The AI Hub provides:
17+
18+
* A backend API implementing the
19+
[Nevermined Query Protocol](https://docs.nevermined.io/docs/protocol/query-protocol). This backend can provide the REST API for querying any AI Agent. So AI Builders don't need to define and build the API themselves and focus on the AI piece.
20+
* Access control. Only users that are subscsribers for the Payment Plan giving access to the Agent can send Tasks to it.
21+
* Dynamic cost of the queries of the users depending on the AI Tasks complexity. The AI Agent can report back the cost in credits of the individual Steps composing the task returning back the **cost** attribute. The total cost of the task can not go over the maximum cost pre-defined in the task.
22+
* Automatic accounting for the usage of the Agent. Subscribers sending Tasks to the Agent will be charged in credits for their Tasks. When they use all the credits they have available the access will be restricted, so if they want to continue using the Agent they must topup.
23+
* Orchestration of tasks. The backend allow AI builders to define their workflow of Steps and receive the Steps to process in the right order. When all the Steps resolving a Task are **Completed**, the backend will complete the whole Task successfully. If any of the Steps fails, the backend will complete the whole Task as **Failed**.
24+
25+
## How an AI Builder can use the AI Hub?
26+
27+
It's very simple. An AI Builder just needs to:
28+
29+
1. Get their own [Nevermined API Key](../tutorials/integration/nvm-api-keys)
30+
2. Install the [Payments library](../libraries/) in their project
31+
3. Integrate with the AI Hub to start [processing AI Tasks](../libraries/process-tasks)
32+

docs/libraries/08-process-tasks.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import TabItem from '@theme/TabItem';
99
# How AI Builders can process AI Tasks?
1010

1111
:::note
12-
This feature is specific for AI Agents Services using the Nevermined AI Infrastructure.
12+
This feature is specific for AI Agents Services using the <ins>Nevermined AI Hub</ins>.
1313
:::
1414

1515
## Benefits of delegating the API to Nevermined AI Infrastructure
@@ -63,6 +63,21 @@ The AI Builders can create simple worker AI process subscribing to Nevermined to
6363
</TabItem>
6464
</Tabs>
6565

66-
This means with this feature, creating an AI Agent is as simple as calling a subscribe and resolving the steps part of the tasks.
66+
Using this, create an AI Agent is as simple as calling a subscribe and resolving the steps part of the tasks.
6767

68+
As you can see in the above code, the agent can subscribe to the events related with AI tasks created by the users and process them. For doing that it just needs to implement a callback function that will get the AI task input parameters and process it.
69+
70+
### AI Tasks and Steps
71+
72+
The AI tasks are composed by several steps. Each step is a part of the task that the AI Agent needs to process. The steps are processed sequentially and the agent can update the status of the step and the output of the step. You can see the steps as a workflow that the AI Agent needs to process to be completed.
73+
74+
The AI Agent only needs to process the steps and update the status of the step and the output of the step. The rest of the logic is managed by **Nevermined AI Hub**.
75+
76+
When a user requests a task to an AI Agent, by default is created one task with one step. This first step has the **"init"** name. When the AI agent receives the **init** step can:
77+
78+
* If the AI task is simple and **doesn't require several steps**, it can process the step and update the status of the step to **Completed** and the **is_last** attribute as **true**. This will mark the whole task as completed.
79+
80+
* If the AI task requires **multiple steps**, the AI Agent can create more steps and setup the order of execution and configuration of them. This can be done by defining the **name**, **order** and **predecessor** step.
81+
82+
We will see different code examples about how to do this in the following section.
6883

0 commit comments

Comments
 (0)