Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions docs/coffee-agntcy/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ With CoffeeAGNTCY, you can:

* Learn how to leverage the AGNTCY App SDK Factory to write transport and agentic protocol-agnostic clients and server code.

* Explore SLIM and its support for broadcast and unicast messaging.
* Explore SLIM v0.4.0 and its support for request-reply, unicast (fire-and-forget), publisher/subscriber, and group communication patterns (with additional support for NATS transport for publisher/subscriber messaging).

* Enable observability with the AGNTCY Observe SDK.

Expand Down Expand Up @@ -42,21 +42,23 @@ Learn more on how to deploy Corto locally by visiting the [Corto deployment guid

### Lungo

Lungo is our ever-evolving demo application. As AGNTCY expands, Lungo grows alongside it. It adds new features and capabilities, demonstrating how they work together in an interoperable ecosystem. Like the Corto demo, it includes a LangGraph-orchestrated supervisor agent, but instead of connecting to a single farm, Lungo integrates with three.
Lungo is our ever-evolving demo application. As AGNTCY expands, Lungo grows alongside it. It adds new features and capabilities, demonstrating how they work together in an interoperable ecosystem. Like the Corto demo, it includes a LangGraph-orchestrated supervisor agent, but instead of connecting to a single farm, Lungo integrates with different farms and logistics agents in two different setups like publisher/subscriber and group communication.

Each farm is designed to demonstrate different agentic protocols and implementations. For now, the agents are similar to Corto’s: LangGraph-orchestrated A2A agents that communicate with the exchange using both pub/sub and request–response patterns. The farms are distinguished by "location". In addition to being a A2A server, the Colombia farm acts as a MCP client that connects to a Weather MCP Server.
#### Setup 1: Publisher/Subscriber pattern

By default, all agents and MCP servers use SLIM as the transport layer, showcasing its flexibility by switching between one-to-many broadcasts via pub/sub and direct agent-to-agent request–response interactions based on the need specified by the prompt. To learn more about how this works, explore the [CoffeeAGNTCY SLIM Integration](./slim-coffee-agntcy.md)
Each farm is designed to demonstrate different agentic protocols and implementations. For now, the agents are similar to Corto’s: LangGraph-orchestrated A2A agents that communicate with the exchange using both pub/sub and request–response patterns. The farms are distinguished by "location". In addition to being an A2A server, the Colombia farm acts as a MCP client that connects to a Weather MCP Server.

AGNTCY’s Agent Identity Service handles authentication between agents, allowing them to verify each other’s identity before establishing a connection. This exemplifies the requirement within larger agentic networks for secure communication and trust. To learn more about how this works in Lungo, explore the [CoffeeAGNTCY Identity integration](./identity-coffee-agntcy.md)
All agents and MCP servers use SLIM as the transport layer (can switch between transports: SLIM and NATS), showcasing its flexibility by switching between one-to-many broadcasts via pub/sub and direct agent-to-agent request–response interactions based on the need specified by the prompt. To learn more about how this works, explore the [CoffeeAGNTCY SLIM Transport Integration](./slim-coffee-agntcy.md).

AGNTCY’s Agent Identity Service handles authentication between agents, allowing them to verify each other’s identity before establishing a connection. This exemplifies the requirement for secure communication and trust within larger agentic networks. To learn more about how this works in Lungo, explore the [CoffeeAGNTCY Identity integration](./identity-coffee-agntcy.md)

```mermaid
flowchart TB
%% Top
S["Supervisor Agent<br/>Buyer"]
S["Auction Supervisor Agent<br/>Buyer"]

%% Middle transport bus
SLIM["SLIM : PubSub or Request Response"]
SLIM["SLIM(NATS can be used as transport too) : PubSub or Request Response"]

%% Farm agents
F1["Coffee Farm Agent<br/>Brazil<br/>(Unverified)"]
Expand All @@ -73,4 +75,18 @@ flowchart TB
SLIM --> F3
F2 --> MCP
```

#### Setup 2: Group Communication pattern

In this setup, we have multiple LangGraph agents that communicate with each other using SLIM's group communication, where all agents participate in a group session, sending messages and listening for relevant chats from other agents in the group. The logistics agent sends a message to other agents (farm, shipper, accountant) to fulfill the coffee order, and all other agents listen to the communication and respond accordingly to complete the order.

```mermaid
graph LR
SA[Shipper Agent] <--> GC((SLIM: group communication))
AA[Accountant Agent] <--> GC
GC <--> LA[Logistics Agent]
GC <--> TF[Tatooine Farm Agent]
```


Learn more on how to deploy Lungo locally by visiting the [Lungo Deployment Guide](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/README.md)
88 changes: 66 additions & 22 deletions docs/coffee-agntcy/slim-coffee-agntcy.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,92 @@
#SLIM in CoffeeAGNTCY
# SLIM v0.4.0 in CoffeeAGNTCY

CoffeeAGNTCY uses [SLIM](../messaging/slim-core.md) as its default transport layer for all inter-agent communication. SLIM supports both **unicast** (1-to-1) and **broadcast** (1-to-many) messaging patterns, making it well-suited for CoffeeAGNTCY’s dynamic multi-agent workflows.
CoffeeAGNTCY works with both NATS and [SLIM](../messaging/slim-core.md) transports and illustrates multiple messaging patterns including request-reply, unicast (fire-and-forget), publisher/subscriber, and group communication, making them well-suited for CoffeeAGNTCY's dynamic multi-agent workflows.

**Default Transport Usage:**

- **NATS**: Default for publisher/subscriber patterns.
- **SLIM**: Default for group communication patterns.

You can find the transport configuration [here](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/config/config.py#L9-L10).

The **AGNTCY App SDK** abstracts the underlying SLIM protocol behind a unified factory API. This allows developers to instantiate SLIM-based A2A (agent-to-agent) clients and servers without dealing directly with low-level transport details. Learn more about the App SDK [here](https://github.com/agntcy/app-sdk).

## Instantiating the Factory and SLIM Transport
!!! note
Publisher/subscriber support is available using **NATS transport**, which can be used instead of SLIM transport for Lungo Publisher/Subscriber pattern.

## Instantiating the Factory and SLIM Transport

```python
factory = AgntcyFactory("name_of_agent", enable_tracing=True)
transport = factory.create_transport("SLIM", endpoint=SLIM_ENDPOINT)
transport = factory.create_transport("SLIM", endpoint=SLIM_ENDPOINT, name="default/default/graph")
```

Here:
- `AgntcyFactory` initializes the factory for the agent.
- `create_transport("SLIM", ...)` provisions a SLIM transport instance connected to the configured endpoint.
Where:

* `AgntcyFactory` initializes the factory for the agent.
* `create_transport("SLIM", ...)` provisions a SLIM transport instance connected to the configured endpoint.

## Sending Messages

SLIM accommodates both targeted and broadcast messaging within the same API:

- **1-to-1 Message**
* **1-to-1 Message**

Used when the supervisor agent needs to send a request to a single farm agent:
Used when the supervisor agent needs to send a request to a single farm agent:

```python
response = await client.send_message(request)
```
```python
response = await client.send_message(request)
```

- **Broadcast Message**
* **Publisher/Subscriber Pattern**

Used when the supervisor agent sends the same request to multiple farm agents and waits for all (or a subset) of responses:
Used when the supervisor agent sends the same request to multiple farm agents and waits for all the responses:

```python
responses = await client.broadcast_message(request, expected_responses=3)
```
```python
responses = await client.broadcast_message(request, broadcast_topic=BROADCAST_TOPIC, recipients=recipients)
```

The `expected_responses` parameter defines how many replies the caller waits for before proceeding.
Here the `broadcast_topic` is the topic to which the message is broadcasted and the `recipients` is the list of agents to which the message is sent.

* **Group Communication Pattern**

Used when multiple agents participate in a group chat session, where all agents can send messages and listen to communications from other agents in the group:

```python
responses = await client.broadcast_message(
request,
broadcast_topic=f"{uuid4()}",
recipients=recipients,
end_message="DELIVERED",
group_chat=True,
timeout=60,
)
```

Where:

* `broadcast_topic` is the topic to which the message is broadcasted.
* `recipients` is the list of agents to which the message is sent.
* `end_message` is the message that is sent to all agents when the group chat is closed.
* `group_chat` is a boolean that indicates whether we want to send a message as a group chat or not.
* `timeout` is the timeout for the group chat session.

## Example Implementations

You can explore the CoffeeAGNTCY code to see these concepts in context:

- **Client implementation** (message sending logic):
[coffee_agents/lungo/exchange/graph/tools.py](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/exchange/graph/tools.py)
Publisher/Subscriber pattern:

- **Client implementation** (message sending logic):
[coffee_agents/lungo/agents/supervisors/auction/graph/tools.py](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/agents/supervisors/auction/graph/tools.py)

- **Server implementation** (message handling logic):
[coffee_agents/lungo/agents/farms/brazil/farm_server.py](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/agents/farms/brazil/farm_server.py)

Group Communication pattern:

- **Client implementation** (message sending logic):
[coffee_agents/lungo/agents/supervisors/logistic/graph/tools.py](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/agents/supervisors/logistic/graph/tools.py)

- **Server implementation** (message handling logic):
[coffee_agents/lungo/farms/brazil/farm_server.py](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/farms/brazil/farm_server.py)
- **Server implementation** (message handling logic):
[coffee_agents/lungo/agents/logistics/accountant/server.py](https://github.com/agntcy/coffeeAgntcy/blob/main/coffeeAGNTCY/coffee_agents/lungo/agents/logistics/accountant/server.py)
Loading