agents

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: BSD-2-Clause, Unlicense Imports: 24 Imported by: 0

Documentation

Overview

A simple agent that notices blackboard changing

Concludes by putting a future call to itself back into the slipnet controller A more general, non slipnet specific version may be better in the future. for now we stay narrow. Cognitive clock?

A base visualization without interaction

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchA2ALatency100MiB

func BenchA2ALatency100MiB(b *B)

func BenchA2ALatency10MiB

func BenchA2ALatency10MiB(b *B)

func BenchA2ALatency1GiB

func BenchA2ALatency1GiB(b *B)

func BenchA2ALatency1KiB

func BenchA2ALatency1KiB(b *B)

func BenchA2ALatency1MiB

func BenchA2ALatency1MiB(b *B)

func BenchA2ALatency4KiB

func BenchA2ALatency4KiB(b *B)

func BenchAgentBBLatency

func BenchAgentBBLatency(b *B)

Benchmark 2: Agent to BB latency

func BenchAgentOverhead

func BenchAgentOverhead(b *B)

func GetAgentPipe

func GetAgentPipe(bb_addr string, tags ...string) (snd *PipeSender, rcv *PipeReceiver)

Get sender and receiver connected by the provided tags

func RandStringRunes

func RandStringRunes(n int) string

Types

type B

type B struct {
	Name string
	N    int           // the number of iterations
	T    time.Duration // total time taken
	Err  error         // any returned errors
	// contains filtered or unexported fields
}

type BFunc

type BFunc func(b *B)

We roughly mimic the basics of Go's benchmarking structure

type BufferedMessage

type BufferedMessage struct {
	Sender  string
	Message string
	Tags    []string
}

type ChangeAgent

type ChangeAgent struct {
	LastHash string
	client.CoreAgent
	// contains filtered or unexported fields
}

func NewChangeAgent

func NewChangeAgent(addr string, n_msg int) *ChangeAgent

Change agent is a "meta" agent monitoring blackboard state

func (*ChangeAgent) Loop

func (agt *ChangeAgent) Loop(ctx context.Context) (cont bool, err error)

This agent starts, does it job, then dies

func (*ChangeAgent) Setup

func (agt *ChangeAgent) Setup() error

type ChatAgent

type ChatAgent struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

func (*ChatAgent) Done added in v0.2.6

func (c *ChatAgent) Done() chan struct{}

func (*ChatAgent) GUICompleted

func (c *ChatAgent) GUICompleted() chan struct{}

func (*ChatAgent) Loop

func (c *ChatAgent) Loop(ctx context.Context) (bool, error)

func (*ChatAgent) SetModeLine

func (c *ChatAgent) SetModeLine(msg string)

func (*ChatAgent) SetTags

func (c *ChatAgent) SetTags(tags []string)

func (*ChatAgent) Setup

func (c *ChatAgent) Setup() error

func (*ChatAgent) Stop added in v0.2.6

func (c *ChatAgent) Stop()

func (*ChatAgent) TriggerRedraw

func (c *ChatAgent) TriggerRedraw()

type Chatterbox added in v0.2.6

type Chatterbox struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

Chatterbox is a testing agent designed to illustrate chains of messaging

in core. We try to simulate pseudo processing conversation/dynamics. The intent it to produce chains of conversations between agents.

func (*Chatterbox) Loop added in v0.2.6

func (c *Chatterbox) Loop(ctx context.Context) (bool, error)

We want to favor longer chains of conversation Chatterboxes take three actions: 1. tell someone new (createAgent on topic/tag) # introduce new topics 2. discuss (reply to an ongoing conversation on topic) - Reply prob high if shared tag, if no shared tag p = lifetime(t) # connect topics 3. leave or change the conversation p = lifetime(t) # expire agents

func (*Chatterbox) SetTopic added in v0.2.6

func (c *Chatterbox) SetTopic(topic string)

func (*Chatterbox) Setup added in v0.2.6

func (c *Chatterbox) Setup() error

type NetworkBenchmarkAgent

type NetworkBenchmarkAgent struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

func (*NetworkBenchmarkAgent) Loop

func (a *NetworkBenchmarkAgent) Loop(ctx context.Context) (cont bool, err error)

NetworkBenchmarkAgent runs all of our network benchmarks and reports results to the blackboard No statistics possible with this approach though (just tracking total time)

func (*NetworkBenchmarkAgent) Setup

func (a *NetworkBenchmarkAgent) Setup() error

type PingAgent

type PingAgent struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

func (*PingAgent) Loop

func (a *PingAgent) Loop(ctx context.Context) (cont bool, err error)

This loop is a good example of listening for different types of messages

func (*PingAgent) PrimeBlackboard added in v0.2.6

func (a *PingAgent) PrimeBlackboard()

func (*PingAgent) Setup

func (a *PingAgent) Setup() error

type PipeReceiver

type PipeReceiver struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

func (*PipeReceiver) Receive

func (a *PipeReceiver) Receive(timeout time.Duration) ([]byte, error)

type PipeSender

type PipeSender struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

This agent pipe structure is supposed to be a super lightweight set of connected agents with send and receive tags already set up. It's more "udp" in nature in that we eschew error handling and let it fly

I think these agents will leak goroutines TODO: we need a way pass anything that inherits from a BasicAgent and kill any running goroutines

func (*PipeSender) Send

func (a *PipeSender) Send(data []byte)

type PongAgent

type PongAgent struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

func (*PongAgent) Loop

func (a *PongAgent) Loop(ctx context.Context) (cont bool, err error)

Pong listens for Pings and replies with pongs

func (*PongAgent) Setup

func (a *PongAgent) Setup() error

type ReplayAgent added in v0.2.6

type ReplayAgent struct {
	client.CoreAgent // BB on which we will listen

	Addr              string
	RemoteAddr        string
	OutgoingQueueSize int
	// contains filtered or unexported fields
}

func (*ReplayAgent) ClearReplayQueue added in v0.2.6

func (r *ReplayAgent) ClearReplayQueue() error

Sit on the outgoing queue and post to the blackboard

func (*ReplayAgent) Loop added in v0.2.6

func (r *ReplayAgent) Loop(ctx context.Context) (bool, error)

func (*ReplayAgent) Setup added in v0.2.6

func (r *ReplayAgent) Setup() error

type TimeWatcher added in v0.2.6

type TimeWatcher struct {
	// contains filtered or unexported fields
}

func NewTimeWatcher added in v0.2.6

func NewTimeWatcher(d time.Duration) *TimeWatcher

func (*TimeWatcher) TimeLimit added in v0.2.6

func (t *TimeWatcher) TimeLimit() time.Duration

func (*TimeWatcher) Watch added in v0.2.6

func (t *TimeWatcher) Watch() error

type WatchdogAgent added in v0.2.6

type WatchdogAgent struct {
	client.CoreAgent
	client.Controller
	Watcher

	TimeLimit   time.Duration
	LogInterval time.Duration
	// contains filtered or unexported fields
}

Watchdog Agent wraps a watchdog and sends a halt when the watcher triggers

func NewWatchdogAgent added in v0.2.6

func NewWatchdogAgent(bb_addr string) *WatchdogAgent

func (*WatchdogAgent) Loop added in v0.2.6

func (w *WatchdogAgent) Loop(ctx context.Context) (bool, error)

func (*WatchdogAgent) SetWatcher added in v0.2.6

func (w *WatchdogAgent) SetWatcher(wa Watcher)

func (*WatchdogAgent) Setup added in v0.2.6

func (w *WatchdogAgent) Setup() error

type Watcher added in v0.2.6

type Watcher interface {
	Watch() error
}

type WebAgent added in v0.2.6

type WebAgent struct {
	client.CoreAgent
	*sync.WaitGroup
	// contains filtered or unexported fields
}

func NewWebAgent added in v0.2.6

func NewWebAgent(bb_addr string) *WebAgent

func (*WebAgent) BlackboardHandler added in v0.2.6

func (wa *WebAgent) BlackboardHandler(w http.ResponseWriter, r *http.Request)

func (*WebAgent) IndexHandler added in v0.2.6

func (wa *WebAgent) IndexHandler(w http.ResponseWriter, r *http.Request)

func (*WebAgent) JSHandler added in v0.2.6

func (wa *WebAgent) JSHandler(w http.ResponseWriter, r *http.Request)

func (*WebAgent) ListenAndServe added in v0.2.6

func (wa *WebAgent) ListenAndServe(addr string) error

func (*WebAgent) LoggingMiddleware added in v0.2.6

func (wa *WebAgent) LoggingMiddleware(next http.Handler) http.HandlerFunc

This page functions more like a web app using JS to interact with the new blackboard that is created when visiting this page.

Thought: agent design should almost always be "fire and forget". Transactional agents are ineffective and slow. Streaming agents utilize the system to the fullest effect. Get the middle-agent out of the way.

The web interface

func (*WebAgent) Loop added in v0.2.6

func (wa *WebAgent) Loop(ctx context.Context) (bool, error)

func (*WebAgent) MessageHandler added in v0.2.6

func (wa *WebAgent) MessageHandler(w http.ResponseWriter, r *http.Request)

func (*WebAgent) Setup added in v0.2.6

func (wa *WebAgent) Setup() error

Fulfill the managed interface

func (*WebAgent) StreamHandler added in v0.2.6

func (wa *WebAgent) StreamHandler(w http.ResponseWriter, r *http.Request)

"proxy" the connection through for BB visibility without direct connection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳