Skip to content

Commit 103f795

Browse files
committed
docs: add quickstart guide to READMEs
1 parent 5389030 commit 103f795

2 files changed

Lines changed: 158 additions & 0 deletions

File tree

README.es.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,85 @@ irc-a-gateway
7979

8080
---
8181

82+
## Guía Rápida (Quickstart)
83+
84+
¡Construyamos tu primera red BFA en 3 minutos!
85+
86+
### 1. Inicia el Gateway
87+
Primero, asegúrate de levantar el Gateway (el enrutador central) en una terminal:
88+
```bash
89+
irc-a-gateway
90+
```
91+
*El Gateway quedará escuchando en `http://127.0.0.1:8000`.*
92+
93+
### 2. Tu primer Agente (A2A)
94+
Crea un archivo llamado `mi_agente.py`, pega este código y ejecútalo con `python mi_agente.py`:
95+
96+
```python
97+
import uvicorn
98+
from bfa_sdk.core.agent import BFAAgent
99+
from a2a.server.agent_execution.context import RequestContext
100+
101+
class AgenteClima(BFAAgent):
102+
def __init__(self):
103+
super().__init__(
104+
agent_id="clima_agent",
105+
name="Agente del Clima",
106+
description="Agente experto en meteorología y clima.",
107+
tags=["clima", "tiempo", "temperatura", "lluvia"],
108+
examples=["¿va a llover hoy?", "¿cuál es la temperatura?"],
109+
url="http://127.0.0.1:8002",
110+
gateway_url="http://127.0.0.1:8000"
111+
)
112+
113+
async def run(self, user_message: str, context: RequestContext) -> str:
114+
# Aquí puedes conectar un LLM real (OpenAI, Anthropic, etc.)
115+
return f"Recibí tu consulta sobre el clima: '{user_message}'. ¡Hoy hace un día hermoso!"
116+
117+
agent = AgenteClima()
118+
app = agent.app
119+
120+
if __name__ == "__main__":
121+
uvicorn.run(app, host="127.0.0.1", port=8002)
122+
```
123+
124+
### 3. Tu primer Servidor de Herramientas (MCP)
125+
Crea un archivo llamado `mi_mcp.py`, pega este código y ejecútalo con `python mi_mcp.py`:
126+
127+
```python
128+
import uvicorn
129+
import asyncio
130+
import threading
131+
from bfa_sdk.core.mcp import BFAMCP
132+
133+
mcp = BFAMCP("Herramientas del Clima")
134+
135+
@mcp.tool(
136+
name="obtener_temperatura",
137+
description="Devuelve la temperatura de una ciudad.",
138+
tags=["temperatura", "grados", "ciudad"],
139+
examples=["temperatura en madrid", "grados en lima"]
140+
)
141+
async def obtener_temperatura(ciudad: str) -> str:
142+
return f"La temperatura en {ciudad} es de 24°C."
143+
144+
# Auto-registro en el Gateway
145+
async def startup():
146+
await asyncio.sleep(1)
147+
await mcp.register_with_gateway("http://127.0.0.1:8000", "http://127.0.0.1:8003")
148+
149+
threading.Thread(target=lambda: asyncio.run(startup()), daemon=True).start()
150+
151+
app = mcp.app
152+
153+
if __name__ == "__main__":
154+
uvicorn.run(app, host="127.0.0.1", port=8003)
155+
```
156+
157+
¡Listo! Ya tienes un Gateway, un Agente y un Servidor MCP conectados semánticamente y protegidos con tokens DET.
158+
159+
---
160+
82161
## Despliegue con Docker (Contenedor del Gateway BFA)
83162

84163
Podés ejecutar el Gateway BFA (incluyendo su enrutador semántico de búsqueda vectorial y el panel de control interactivo en modo oscuro) como un microservicio contenedorizado usando Docker o Docker Compose.

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,85 @@ irc-a-gateway
7979

8080
---
8181

82+
## Quickstart (Hello World)
83+
84+
Let's build your first BFA network in 3 minutes!
85+
86+
### 1. Start the Gateway
87+
First, start the Gateway (the central semantic router) in your terminal:
88+
```bash
89+
irc-a-gateway
90+
```
91+
*The Gateway will start listening on `http://127.0.0.1:8000`.*
92+
93+
### 2. Your first Agent (A2A)
94+
Create a file named `my_agent.py`, paste this code, and run it with `python my_agent.py`:
95+
96+
```python
97+
import uvicorn
98+
from bfa_sdk.core.agent import BFAAgent
99+
from a2a.server.agent_execution.context import RequestContext
100+
101+
class WeatherAgent(BFAAgent):
102+
def __init__(self):
103+
super().__init__(
104+
agent_id="weather_agent",
105+
name="Weather Agent",
106+
description="Expert agent in meteorology and weather.",
107+
tags=["weather", "temperature", "rain", "forecast"],
108+
examples=["will it rain today?", "what is the temperature?"],
109+
url="http://127.0.0.1:8002",
110+
gateway_url="http://127.0.0.1:8000"
111+
)
112+
113+
async def run(self, user_message: str, context: RequestContext) -> str:
114+
# Connect a real LLM here (OpenAI, Anthropic, etc.)
115+
return f"I received your weather query: '{user_message}'. It's a beautiful day!"
116+
117+
agent = WeatherAgent()
118+
app = agent.app
119+
120+
if __name__ == "__main__":
121+
uvicorn.run(app, host="127.0.0.1", port=8002)
122+
```
123+
124+
### 3. Your first Tools Server (MCP)
125+
Create a file named `my_mcp.py`, paste this code, and run it with `python my_mcp.py`:
126+
127+
```python
128+
import uvicorn
129+
import asyncio
130+
import threading
131+
from bfa_sdk.core.mcp import BFAMCP
132+
133+
mcp = BFAMCP("Weather Tools")
134+
135+
@mcp.tool(
136+
name="get_temperature",
137+
description="Returns the current temperature of a city.",
138+
tags=["temperature", "degrees", "city"],
139+
examples=["temperature in london", "degrees in new york"]
140+
)
141+
async def get_temperature(city: str) -> str:
142+
return f"The temperature in {city} is 24°C."
143+
144+
# Auto-register with the Gateway
145+
async def startup():
146+
await asyncio.sleep(1)
147+
await mcp.register_with_gateway("http://127.0.0.1:8000", "http://127.0.0.1:8003")
148+
149+
threading.Thread(target=lambda: asyncio.run(startup()), daemon=True).start()
150+
151+
app = mcp.app
152+
153+
if __name__ == "__main__":
154+
uvicorn.run(app, host="127.0.0.1", port=8003)
155+
```
156+
157+
Done! You now have a Gateway, an Agent, and an MCP Server semantically connected and secured by DET tokens.
158+
159+
---
160+
82161
## Docker Deployment (BFA Gateway Container)
83162

84163
You can run the BFA Gateway (including its semantic search router and dark-mode management dashboard) as a containerized microservice using Docker or Docker Compose.

0 commit comments

Comments
 (0)