Skip to content

Commit

Permalink
feat(docs): add Local tags and other fixes to code outputs (#1020)
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Croft <[email protected]>
Co-authored-by: gautamgambhir97 <[email protected]>
  • Loading branch information
3 people authored Nov 26, 2024
1 parent 9e947da commit b510429
Show file tree
Hide file tree
Showing 26 changed files with 228 additions and 151 deletions.
10 changes: 5 additions & 5 deletions pages/examples/advanced/_meta.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"open-dialogue-chitchat": {
"title": "Open Dialogue Chit-Chat",
"tags": ["Advanced", "Python", "Dialogues", "Use cases"],
"tags": ["Advanced", "Python", "Dialogues", "Use cases", "Local"],
"timestamp": true
},
"predefined-dialogue-chitchat": {
"title": "Predefined Dialogue Chit-Chat",
"tags": ["Advanced", "Python", "Dialogues", "Use cases"],
"tags": ["Advanced", "Python", "Dialogues", "Use cases", "Local"],
"timestamp": true
},
"async-loops": {
"title": "Asynchronous Loops",
"tags": ["Advanced", "Python", "Communication", "Use Cases"],
"tags": ["Advanced", "Python", "Communication", "Use Cases", "Local"],
"timestamp": true
},
"chat_api_example": {
"title": "Chat API example",
"tags": ["Advanced", "Python", "Dialogues", "Use cases"],
"tags": ["Advanced", "Python", "Dialogues", "Use cases", "Hosted"],
"timestamp": true
},
"deltaV-dialogues": {
"title": "DeltaV Dialogue Chit-Chat",
"tags": ["Advanced", "Python", "Dialogues", "DeltaV"],
"tags": ["Advanced", "Python", "Dialogues", "DeltaV", "Hosted"],
"timestamp": true
}
}
2 changes: 1 addition & 1 deletion pages/guides/agent-courses/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"introductory-course": {
"title": "Agents 101",
"tags": ["Beginner", "Python"]
"tags": ["Beginner", "Python", "Agents"]
},
"agents-for-ai": {
"title": "Agents 101 for AI Engine",
Expand Down
5 changes: 2 additions & 3 deletions pages/guides/agent-courses/introductory-course.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,9 @@ Checkout the following documentation and resources for a better understanding of

### Registering your Agents to the Open Marketplace

Agent registration in the [Almanac ↗️](/references/contracts/uagents-almanac/almanac-overview) contract is a key feature enabling Agents discoverability as well as remote Agents communication. When Agents regiterin the Almanac, they become part of the Open Marketplace and become avaiable for interactions with other users and Agents registered in the contract. To register, Agents must pay a small fee. Therefore your agents need to have funds available in their Fetch wallet address.
Agent registration in the [Almanac ↗️](/references/contracts/uagents-almanac/almanac-overview) contract is a key feature enabling Agents discoverability as well as remote Agents communication. When Agents regitering the Almanac, they become part of the Open Marketplace and become available for interactions with other users and Agents registered in the contract. To register, Agents must pay a small fee. Therefore your agents need to have funds available in their Fetch wallet address.

Agents can communicate by querying the Almanac and retrieving an HTTP [endpoint ↗️](/references/contracts/uagents-almanac/endpoints) from the recipient agent. Therefore, we need to specify the service endpoints when defining an Agent at registration.
Agents can communicate by querying the Almanac and retrieving an HTTP [endpoint ↗️](/references/contracts/uagents-almanac/endpoints) from the recipient agent. Therefore, we need to specify the service endpoints when defining an Agent at registration.

<Callout type="info" emoji="ℹ️">
HTTP (Hypertext Transfer Protocol) service endpoints are specific locations or URLs (Uniform Resource Locators) on a web server where clients can send HTTP requests to interact with resources or services provided by the server. These endpoints define the entry points for various operations or functions offered by a web service or application.
Expand Down Expand Up @@ -827,7 +827,6 @@ We will have what follows:
</CodeGroup>



Here, we defined a local http address, but you could also define a remote address to allow agent communication over different machines through the internet. Importantly, make sure to add a seed phrase to your Agent, so you don't have to fund different addresses each time you run your agent. The `fund_agent_if_low` is used on the Testnet to make sure your Agent has enough funds in its wallet to register and operate correctly.

<Callout type="info" emoji="ℹ️">
Expand Down
2 changes: 1 addition & 1 deletion pages/guides/agents/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"quickstart": {
"title": "Quickstart",
"tags": ["Beginner", "Python", "local"]
"tags": ["Beginner", "Python", "Local"]
},
"getting-started": {
"title": "Getting Started"
Expand Down
12 changes: 6 additions & 6 deletions pages/guides/agents/advanced/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
},
"register-in-almanac": {
"title": "Almanac Contract",
"tags": ["Advanced", "Python", "Almanac"],
"tags": ["Advanced", "Python", "Almanac", "Local"],
"timestamp": true
},
"agents-async-loops": {
"title": "Agents Asynchronous Loops",
"tags": ["Advanced", "Python", "Communication", "Use Cases"],
"tags": ["Advanced", "Python", "Communication", "Use Cases", "Local"],
"timestamp": true
},
"agent-envelopes": {
Expand All @@ -21,22 +21,22 @@
},
"message-verification": {
"title": "Verify messages with Agents",
"tags": ["Advanced", "Python", "Communication", "Use Cases"],
"tags": ["Advanced", "Python", "Communication", "Use Cases", "Local"],
"timestamp": true
},
"utilizing-api-to-build-network-of-task-and-subtask": {
"title": "Multi-file agent pipeline for AI Engine: Network of Primary and Secondary functions in Agentverse",
"tags": ["Advanced", "Python", "Functions", "AI Engine"],
"tags": ["Advanced", "Python", "Functions", "AI Engine", "Local"],
"timestamp": true
},
"localwallet": {
"title": "Local Wallet",
"tags": ["Advanced", "Python", "Wallet"],
"tags": ["Advanced", "Python", "Wallet", "Local"],
"timestamp": true
},
"name-service": {
"title": "Agents Name Service",
"tags": ["Advanced", "Python", "Name Service"],
"tags": ["Advanced", "Python", "Name Service", "Local"],
"timestamp": true
}
}
1 change: 1 addition & 0 deletions pages/guides/agents/advanced/agents-async-loops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ The output should be similar to the following:

```
Attaching the agent or bureau to the external loop...
```

- Script 2:
Expand Down
2 changes: 2 additions & 0 deletions pages/guides/agents/advanced/message-verification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ Run the script: `python message_verification.py`.
The output should be as follows:

```
WARNING: [alice]: No endpoints provided. Skipping registration: Agent won't be reachable.
WARNING: [ bob]: No endpoints provided. Skipping registration: Agent won't be reachable.
[ bob]: Alice's message verified!
[ bob]: Received message from agent1qf5gfqm48k9acegez3sg82ney2aa6l5fvpwh3n3z0ajh0nam3ssgwnn5me7: hello there bob
[alice]: Bob's message verified!
Expand Down
1 change: 1 addition & 0 deletions pages/guides/agents/advanced/name-service.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ Within your terminal windows you should see something similar to the following:
INFO: [bob-0]: Registering on almanac contract...complete
INFO: [network]: Registering name...
INFO: [network]: Registering name...complete
INFO: [bob-0]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8001&address=agent1qwep424538eh7fcruqcnx8la3q3tgl4tgksrcdtahqs7dqgs4rewsx4jefu
INFO: [bob-0]: Starting server on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO: [bob-0]: Received message from agent1qwquu2d237gntfugrnwch38g8jkl76vdr05qjm4wyps6ap04fvt8vtzhpqw: Hello there bob.
INFO: [bob-0]: Received message from agent1qwquu2d237gntfugrnwch38g8jkl76vdr05qjm4wyps6ap04fvt8vtzhpqw: Hello there bob.
Expand Down
14 changes: 13 additions & 1 deletion pages/guides/agents/advanced/register-in-almanac.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@ There's a few things happening in this script; we initialize Alice with an endpo

We also have to define `agent.run()`. This `.run()` function runs the agent, but more importantly this registers the agent to the Almanac when code is initialized.

Once you run your script, your agent will start the registration process automatically, the balance of the agent's wallet will be checked and funded if needed. Finally, it will try to register on the Almanac contract. Then, we will be ready to start to a remote communication with other agents registered within the Almanac contract.
Once you run your script, your agent will start the registration process automatically. Finally, it will try to register on the Almanac contract. Then, we will be ready to start to a remote communication with other agents registered within the Almanac contract. The output should be similar to:

```
INFO: [Alice]: Registration on Almanac API successful
INFO: [Alice]: Registering on almanac contract...
INFO: [Alice]: Registering on almanac contract...complete
INFO: [Alice]: Hello
INFO: [Alice]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8000&address=agent1qfccl7xc2hrwzntx9rxgf56lh80kuf5av6h4nyk3ywvxyu846zqwyl3g0jf
INFO: [Alice]: Starting server on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: [Alice]: Hello
INFO: [Alice]: Hello
INFO: [Alice]: Hello
```

The output for the above code would be similar to the following:

Expand Down
8 changes: 4 additions & 4 deletions pages/guides/agents/getting-started/_meta.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"whats-an-agent": {
"title": "What's an Agent?",
"tags": ["Beginner", "Python", "local"],
"tags": ["Beginner", "Python"],
"timestamp": true
},
"installing-uagent": {
"title": "uAgents Framework installation",
"tags": ["Beginner", "Python", "local"],
"tags": ["Beginner", "Python"],
"timestamp": true
},
"create-a-uagent": {
"title": "Create your first agent",
"tags": ["Beginner", "Python", "local"],
"tags": ["Beginner", "Python", "Local"],
"timestamp": true
},
"seedphrase": "Seed phrase",
"getting-uagent-address": {
"title": "Agents address",
"tags": ["Beginner", "Python", "Address", "local"],
"tags": ["Beginner", "Python", "Address", "Local"],
"timestamp": true
}
}
2 changes: 1 addition & 1 deletion pages/guides/agents/getting-started/seedphrase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Imagine you have a treasure chest full of your code, but instead of a key, it ha

If you remember your seed phrase, you can open your treasure chest anytime, anywhere, even if you lose the chest. In our case, our chest is our agent identity. However, if someone else learns your seed phrase, they can impersonate your agent! Not just impersonate, but they would also have access to the wallet of the agent. So, it's super important to keep the seed phrase safe, like hiding it in a secret place or writing it down where no one can find it. Never tell anyone your seed phrase unless you really, really trust them!

uAgents creates an address for your agent cryptographically with your defined seed phrase, this all happens out of view in the uAgents library [view the src](https://github.com/fetchai/uAgents/blob/3a76aa0f364fcd6464562f495d722fe80568a24b/python/src/uagents/agent.py#L425).
uAgents creates an address for your agent cryptographically with your defined seed phrase, this all happens out of view in the uAgents library [view the src](https://github.com/fetchai/uAgents/blob/3a76aa0f364fcd6464562f495d722fe80568a24b/python/src/uagents/agent.py#L425).
39 changes: 22 additions & 17 deletions pages/guides/agents/intermediate/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"communicating-with-other-agents": {
"title": "Communicating with other agents",
"tags": ["Intermediate", "Python", "Communication"],
"tags": ["Intermediate", "Python", "Communication", "Local"],
"timestamp": true
},
"protocols": {
Expand All @@ -11,43 +11,42 @@
},
"handlers": {
"title": "Agent Handlers (on_...)",
"tags": ["Intermediate", "Python", "Handlers"],
"tags": ["Intermediate", "Python", "Handlers", "Local"],
"timestamp": true
},
"storage-function": {
"title": "Agents storage functions",
"tags": ["Intermediate", "Python", "Storage"],
"tags": ["Intermediate", "Python", "Storage", "Local"],
"timestamp": true
},

"agent-types": {
"title": "Hosted, Local, and Mailbox Agents",
"tags": ["Intermediate", "Python", "Agents"],
"tags": ["Intermediate", "Python", "Agents", "Hosted", "Local", "Mailbox"],
"timestamp": true
},
"bureau": {
"title": "Bureau",
"tags": ["Intermediate", "Python", "Bureau"],
"tags": ["Intermediate", "Python", "Bureau", "Local"],
"timestamp": true
},
"broadcast": {
"title": "Broadcast",
"tags": ["Intermediate", "Python", "Broadcast"],
"tags": ["Intermediate", "Python", "Broadcast", "Local"],
"timestamp": true
},
"mailbox": {
"title": "Agents Mailboxes",
"tags": ["Intermediate", "Python", "Communication", "Mailbox"],
"tags": ["Intermediate", "Python", "Communication", "Mailbox", "Local"],
"timestamp": true
},
"local-agent-inspector": {
"title": "Local Agent Inspector",
"tags": ["Intermediate", "Python", "Agents"],
"tags": ["Intermediate", "Python", "Agents", "Local"],
"timestamp": true
},
"agent-functions": {
"title": "Agent Functions",
"tags": ["Intermediate", "Python", "Functions", "AI Engine"],
"tags": ["Intermediate", "Python", "Functions", "AI Engine", "Local"],
"timestamp": true
},
"ai-engine-compatible-agent": {
Expand All @@ -57,38 +56,44 @@
},
"options-for-running-local-agents": {
"title": "Options for running local agents",
"tags": ["Intermediate", "Python", "Agentverse"],
"tags": ["Intermediate", "Python", "Agentverse", "Local"],
"timestamp": true
},
"hosted-agent": {
"title": "Hosted agent",
"tags": ["Intermediate", "Python", "Agentverse"],
"tags": ["Intermediate", "Python", "Agentverse", "Hosted"],
"timestamp": true
},
"langchain-rag-agent": {
"title": "Building a RAG Agent",
"tags": ["Intermediate", "Python", "Functions", "LangChain", "AI Engine"],
"tags": [
"Intermediate",
"Python",
"Functions",
"LangChain",
"AI Engine",
"Local"
],
"timestamp": true
},
"rest-endpoints": {
"title": "REST endpoints",
"tags": ["Intermediate", "Python", "REST API", "HTTP Protocols"],
"tags": ["Intermediate", "Python", "REST API", "HTTP Protocols", "Local"],
"timestamp": true
},

"public-private-agents": {
"title": "Public and private Agents",
"tags": ["Intermediate", "Python"],
"timestamp": true
},
"send-tokens": {
"title": "Send tokens with Agents",
"tags": ["Intermediate", "Python", "Use Cases"],
"tags": ["Intermediate", "Python", "Use Cases", "Local"],
"timestamp": true
},
"primary-secondary-functions": {
"title": "Multi-file agent pipeline for AI Engine: Hugging face API to create a multi agent pipeline",
"tags": ["Intermediate", "Python", "Functions", "AI Engine"],
"tags": ["Intermediate", "Python", "Functions", "AI Engine", "Local"],
"timestamp": true
}
}
4 changes: 3 additions & 1 deletion pages/guides/agents/intermediate/agent-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ It is important that you provide the `name`, `port`, `seed` and `endpoint` for y

A few things to note; you'll need to be running this agent on infrastructure that allows you to open a port, in our example we run on port `6145`.

The agent is initialized with an endpoint, and a port - this is so that we can receive messages, and other agents know where to send them. We call `fund_agent_if_low` to get some funds, if we need them. And we define our protocol, which is just an int as seen in the `Request` object.
The agent is initialized with an endpoint, and a port - this is so that we can receive messages, and other agents know where to send them. We call `fund_agent_if_low` to get some funds, if we need them. And we define our protocol, which is just an `int` as seen in the `Request` object.

Our `on_message` doesn't do much other than return a number between 1 and the defined `dice_sides` from the message inclusive. However, the response type is of `UAgentResponse` which is essential to communicate with DeltaV.

Expand All @@ -118,8 +118,10 @@ Finally, we run our agent as follows: `python simple_function.py`

```
INFO: [dungeonsanddragonsdiceroll]: Manifest published successfully: DungeonsAndDragonsDiceRoll
INFO: [dungeonsanddragonsdiceroll]: Registration on Almanac API successful
INFO: [dungeonsanddragonsdiceroll]: Registering on almanac contract...
INFO: [dungeonsanddragonsdiceroll]: Registering on almanac contract...complete
INFO: [dungeonsanddragonsdiceroll]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A6145&address=agent1qvwk0ntr38yyghccrg530hnnm88r5uske4hdcalsa7gqp7sjgx42k4mp62r
INFO: [dungeonsanddragonsdiceroll]: agent1qvh76795enwgnzkrjpedlnqxwv83d8wxnkkcszs9z46zc3qpfs3yvzc5kuw
INFO: [dungeonsanddragonsdiceroll]: Starting server on http://0.0.0.0:6145 (Press CTRL+C to quit)
```
Expand Down
Loading

0 comments on commit b510429

Please sign in to comment.