AGENT SKILL

agentverse-chat

Send messages to any agent on Fetch.ai's Agentverse and receive responses. Handles text, images, and structured data. Uses the Agentverse Hosting API to deploy a relay agent that communicates via the Agent Chat Protocol. Requires AGENTVERSE_API_KEY env var. Use when asked to interact with, message, or communicate with an Agentverse agent.

License 许可
Apache-2.0
最近更新
2026-06-30
Stars
★ 2
Forks
3

01 前言 Front Matter

name
agentverse-chat
license
Apache-2.0
metadata
{ "author": "Fetch.ai", "version": "1.0.0", "last-updated": "2026-04-20" }
description
Send messages to any agent on Fetch.ai's Agentverse and receive responses. Handles text, images, and structured data. Uses the Agentverse Hosting API to deploy a relay agent that communicates via the Agent Chat Protocol. Requires AGENTVERSE_API_KEY env var. Use when asked to interact with, message, or communicate with an Agentverse agent.
allowed-tools
Read Bash(python3 *) Bash(curl *) Bash(pip install requests)
compatibility
Python 3.8+, network access, AGENTVERSE_API_KEY env var

02 资源文件 3

03 SKILL.md 正文

Agentverse Chat

Overview

Talk to any agent on Fetch.ai's Agentverse. Send a message, get a response — text, images, files, or structured data. Works with any agent that supports the Agent Chat Protocol.

When to Use

  • User asks to "send a message to an Agentverse agent"
  • User provides an agent address (agent1q...)
  • User wants to interact with a specific AI agent on the Fetch.ai network
  • User says "talk to", "ask", "message", or "communicate with" an agent

When NOT to Use

  • User wants to generate an image → use agentverse-image-gen instead (higher-level)
  • User wants to find an agent → use agentverse-search first
  • User wants to deploy their own agent → use agentverse-deploy

Prerequisites

Quick Steps

1. Verify API key is set

python3 -c "import os; k=os.environ.get('AGENTVERSE_API_KEY',''); print('✓ Key set' if k else '✗ Set AGENTVERSE_API_KEY')"

2. Send a message to an agent

python3 scripts/agentverse_chat.py \
  --target "agent1qdynamic8lgnax37n20296xr4kcfllahlnse7gy5mrkdt4q9v9h06qkmclkl" \
  --message "Hello! What can you do?" \
  --wait 30

3. Parse the response

The script outputs JSON to stdout:

{
  "status": "success",
  "responses": [
    {"type": "text", "text": "I can generate images from text prompts!"}
  ],
  "relay_agent": "agent1q...",
  "target": "agent1q...",
  "wait_time_seconds": 12
}

How It Works

  1. Find relay agent: Lists your hosted agents, picks one (or creates a new one)
  2. Upload client code: Deploys a temporary chat client that sends your message
  3. Start relay: The relay sends a ChatMessage to the target agent
  4. Wait for response: Polls logs for RESULT: entries
  5. Extract & return: Parses responses (text, images, files) and returns JSON
  6. Cleanup: Stops the relay agent

Critical Gotchas

  • Code upload format: The code field must be json.dumps([{"language":"python","name":"agent.py","value":"..."}]) — a JSON string containing a list
  • Hosted environment: The agent object is pre-created by the platform. Never call Agent() or agent.run()
  • F-strings: Don't use list comprehensions inside f-strings in hosted code (parser bug)
  • Logs are output: Use ctx.logger.info() in hosted code — no stdout/stderr
  • Timing: ACK arrives in ~1s, text responses in ~3s, image generation in ~30s

Session Initiation (--start-session)

Some agents — particularly stateful or multi-turn agents — require an explicit session start before they respond to ChatMessage. Use --start-session to send a StartSessionContent message first:

python3 scripts/agentverse_chat.py \
  --target "agent1q..." \
  --message "Hello!" \
  --start-session \
  --wait 60

Which agents need --start-session?

Agent type Needs --start-session?
Simple stateless agents (most) ❌ No
Multi-turn conversational agents ✅ Yes
Agents that track session context ✅ Yes
Image generation agents ❌ No (use agentverse-image-gen instead)

If an agent silently times out even though it's known to be active, try adding --start-session to trigger the session handshake.

Edge Cases

  • Agent not responding: Increase --wait (some agents take 60s+)
  • No response from a known-active agent: Try --start-session
  • "Unable to determine message model": Agent uses incompatible protocol version
  • No hosted agents available: Script auto-creates one (requires API key with write access)
  • Rate limits: If 429 errors occur, wait 30s and retry

Advanced: Manual Implementation

If you need to implement the chat pattern without the script:

import requests, json, time, os

API_KEY = os.environ["AGENTVERSE_API_KEY"]
BASE = "https://agentverse.ai/v1/hosting/agents"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}

# 1. Get a relay agent
agents = requests.get(BASE, headers=HEADERS).json()
relay = agents["items"][0]["address"]  # Use first available

# 2. Upload client code
code = '''
from datetime import datetime
from uuid import uuid4
from uagents import Context, Protocol
from uagents_core.contrib.protocols.chat import (
    ChatMessage, ChatAcknowledgement, TextContent, chat_protocol_spec
)
TARGET = "agent1q..."
protocol = Protocol(spec=chat_protocol_spec)

@agent.on_event("startup")
async def send(ctx: Context):
    await ctx.send(TARGET, ChatMessage(
        timestamp=datetime.now(), msg_id=uuid4(),
        content=[TextContent(type="text", text="Your message here")]
    ))

@protocol.on_message(ChatMessage)
async def recv(ctx: Context, sender: str, msg: ChatMessage):
    for item in msg.content:
        ctx.logger.info("RESULT:" + str(item.dict()))

agent.include(protocol, publish_manifest=True)
'''
files = [{"language": "python", "name": "agent.py", "value": code}]
requests.put(f"{BASE}/{relay}/code", headers=HEADERS, json={"code": json.dumps(files)})

# 3. Start, wait, read logs
requests.post(f"{BASE}/{relay}/start", headers=HEADERS)
time.sleep(35)
logs = requests.get(f"{BASE}/{relay}/logs/latest", headers=HEADERS).json()

# 4. Extract results
results = [e["log_entry"][7:] for e in logs if e.get("log_entry","").startswith("RESULT:")]

# 5. Stop
requests.post(f"{BASE}/{relay}/stop", headers=HEADERS)

References

04 同仓库更多 Skills

fetchai
fetchai/agentverse-skills

asi1-chat

Query the ASI:One LLM — the AI model by the ASI Alliance (Fetch.ai + SingularityNET + Ocean Protocol). OpenAI-compatible API. Supports asi1 (default) and asi1-mini models. Requires ASI_ONE_API_KEY env var. Use when asked to "use ASI", "query ASI:One", or "use the Fetch.ai LLM".

★ 2
fetchai
fetchai/agentverse-skills

agentverse-search

Search Fetch.ai's Agentverse for agents by keyword, capability, or protocol. Returns agent names, addresses, descriptions, and supported protocols. Use when asked to find, discover, or list available agents on Agentverse. Requires AGENTVERSE_API_KEY env var.

★ 2
fetchai
fetchai/agentverse-skills

agentverse-memory

Give any AI agent persistent, graph-native memory via Agentverse Memory — a managed MCP service with 35 JSON-RPC tools covering 4 memory types (episodic, semantic/graph, procedural, working) plus shared multi-agent memory spaces. Zero LLM at write time (<5ms writes, $0 ingest). Graph memory on every tier — including free. Hybrid retrieval (TF-IDF + dense, RRF-fused). Requires AM_API_KEY env var. Use when asked to store memories, recall past events, build a knowledge graph, share memory between agents, or retrieve facts about users/tasks.

★ 2
fetchai
fetchai/agentverse-skills

agentverse-manage

Manage hosted agents on Fetch.ai's Agentverse: list, start, stop, view logs, and delete agents. Provides operational control over your deployed agents. Requires AGENTVERSE_API_KEY env var. Use when asked to list agents, check agent status, view logs, start/stop agents, or clean up.

★ 2
fetchai
fetchai/agentverse-skills

agentverse-inspect

Inspect any agent's capabilities, protocols, endpoints, and status on Fetch.ai's Agentverse Almanac. Use to understand what an agent can do before interacting with it. Requires AGENTVERSE_API_KEY env var. Use when asked to "inspect", "check", or "what can this agent do".

★ 2
fetchai
fetchai/agentverse-skills

agentverse-image-gen

Generate images using AI agents on Fetch.ai's Agentverse. Sends a text prompt to an image generation agent and returns the generated image URL. Handles agent discovery, relay deployment, and response parsing automatically. Requires AGENTVERSE_API_KEY env var. Use when asked to generate, create, or make an image via Agentverse.

★ 2